Questions tagged []

ASP.NET is a Microsoft web application development framework that allows programmers to build dynamic web sites, web applications and web services. It is useful to use this tag in conjunction with the project type tag e.g. [], [], or []. Do NOT use this tag for questions about ASP.NET Core - use [] instead.

ASP.NET was first released in January 2002 with version 1.0 of the .NET Framework and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime (), allowing programmers to write ASP.NET code using any supported .NET language.

Typically, ASP.NET uses a WebForms style of development, which was also the original method of developing web applications in ASP.NET. Web forms are a model which mimics the control/event model of classic Windows Forms development providing the illusion of stateful pages.

In March of 2009, Microsoft released version 1.0 of the ASP.NET MVC Framework. As an alternative model to web forms, this framework applies the Model-View-Controller pattern to web applications in ASP.NET.

As ASP.NET includes its own controls library for web forms, wrapping HTML controls and adding functionality to them, any ASP.NET controls have as markup <asp:ctrl_name></asp:ctrl_name>.

For example:

<asp:Label ID="Label1" runat="server"></asp:label>

Will be rendered like a <span></span>

For ASP.NET MVC, instead of a control library, there exist HTML helper methods which make it easier to blend HTML markup with code, while allowing developers to create views in mostly pure HTML.

There are two templating engines for ASP.NET MVC. The original one is and uses .aspx and .ascx files for views and partial views, respectively. The other, newer one is , which focuses on developer productivity by providing more concise and less obtrusive syntax.

More information at:

It is useful to use this tag in conjunction with the project type tag e.g. , , or . DO NOT use this tag for questions about ASP.NET Core - use instead.

Development Tips:

Tips for good website design, which loads and works faster

Initial release:

January 2002

Stable Release:

Stable release 4.8 (18 Apr 2019)

Latest Preview Release:

Preview release 6.0.0-preview.3 (8 Apr 2021)

Important Questions

Essential Downloads



Chat Room


373735 questions
42 answers

How do I format a Microsoft JSON date?

I'm taking my first crack at Ajax with jQuery. I'm getting my data onto my page, but I'm having some trouble with the JSON data that is returned for Date data types. Basically, I'm getting a string back that looks like…
Mark Struzinski
  • 32,945
  • 35
  • 107
  • 137
48 answers

A potentially dangerous Request.Form value was detected from the client

Every time a user posts something containing < or > in a page in my web application, I get this exception thrown. I don't want to go into the discussion about the smartness of throwing an exception or crashing an entire web application because…
  • 28,068
  • 16
  • 63
  • 80
42 answers

Path.Combine for URLs?

Path.Combine is handy, but is there a similar function in the .NET framework for URLs? I'm looking for syntax like this: Url.Combine("", "/Images/Image.jpg") which would return: ""
Brian MacKay
  • 31,133
  • 17
  • 86
  • 125
31 answers

JavaScriptSerializer - JSON serialization of enum as string

I have a class that contains an enum property, and upon serializing the object using JavaScriptSerializer, my json result contains the integer value of the enumeration rather than its string "name". Is there a way to get the enum as a string in my…
Omer Bokhari
  • 57,458
  • 12
  • 44
  • 58
60 answers

Could not find a part of the path ... bin\roslyn\csc.exe

I am trying to run an ASP.NET MVC (model-view-controller) project retrieved from TFS (Team Foundation Server) source control. I have added all assembly references and I am able to build and compile successfully without any error or warning. But I…
  • 13,440
  • 6
  • 26
  • 43
16 answers

Maximum request length exceeded.

I am getting the error Maximum request length exceeded when I am trying to upload a video in my site. How do I fix this?
Surya sasidhar
  • 29,607
  • 57
  • 139
  • 219
24 answers

How to set the Content-Type header for an HttpClient request?

I'm trying to set the Content-Type header of an HttpClient object as required by an API I am calling. I tried setting the Content-Type like below: using (var httpClient = new HttpClient()) { httpClient.BaseAddress = new…
  • 15,244
  • 5
  • 33
  • 45
18 answers

Change the selected value of a drop-down list with jQuery

I have a drop-down list with known values. What I'm trying to do is set the drop down list to a particular value that I know exists using jQuery. Using regular JavaScript, I would do something like: ddl = document.getElementById("ID of element goes…
  • 10,485
  • 4
  • 23
  • 18
16 answers

If a folder does not exist, create it

I use a FileUploader control in my application. I want to save a file to a specified folder. If this folder does not exist, I want to first create it, and then save my file to this folder. If the folder already exists, then just save the file in…
  • 14,848
  • 18
  • 51
  • 70
14 answers

Ajax request returns 200 OK, but an error event is fired instead of success

I have implemented an Ajax request on my website, and I am calling the endpoint from a webpage. It always returns 200 OK, but jQuery executes the error event. I tried a lot of things, but I could not figure out the problem. I am adding my code…
Pankaj Mishra
  • 20,197
  • 16
  • 66
  • 103
25 answers

ASP.NET Web Site or ASP.NET Web Application?

When I start a new ASP.NET project in Visual Studio, I can create an ASP.NET Web Application or I can create an ASP.NET Web Site. What is the difference between ASP.NET Web Application and ASP.NET Web Site? Why would I choose one over other? Is the…
Robert S.
  • 25,266
  • 14
  • 84
  • 116
43 answers

Regex for password must contain at least eight characters, at least one number and both lower and uppercase letters and special characters

I want a regular expression to check that: A password contains at least eight characters, including at least one number and includes both lower and uppercase letters and special characters, for example #, ?, !. It cannot be your old password or…
Swapnil Tatkondawar
  • 8,947
  • 3
  • 13
  • 3
12 answers

How can I retrieve Id of inserted entity using Entity framework?

I have a problem with Entity Framework in ASP.NET. I want to get the Id value whenever I add an object to database. How can I do this? According to Entity Framework the solution is: using (var context = new EntityContext()) { var customer = new…
  • 8,003
  • 3
  • 15
  • 3
20 answers

In C#, what is the difference between public, private, protected, and having no access modifier?

All my college years I have been using public, and would like to know the difference between public, private, and protected? Also what does static do as opposed to having nothing?
  • 21,709
  • 30
  • 113
  • 139
11 answers

How do I import a namespace in Razor View Page?

How to import a namespace in Razor View Page?
  • 59,111
  • 42
  • 110
  • 159
2 3
99 100