Questions tagged [asp.net]

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. [asp.net-mvc], [asp.net-webforms], or [asp.net-web-api]. Do NOT use this tag for questions about ASP.NET Core - use [asp.net-core] 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: www.asp.net

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

References

Books:

Chat Room

IDE

373735 questions
320
votes
36 answers

System.MissingMethodException: Method not found?

Previous working asp.net webforms app now throws this error: System.MissingMethodException: Method not found The DoThis method is on the same class and it should work. I have a generic handler as such: public class MyHandler: IHttpHandler { …
user603007
  • 11,416
  • 39
  • 104
  • 168
319
votes
1 answer

What are all the user accounts for IIS/ASP.NET and how do they differ?

Under Windows Server 2008 with ASP.NET 4.0 installed there is a whole slew of related user accounts, and I can't understand which one is which, how to they differ, and which one is REALLY the one that my app runs under. Here's a list: IIS_IUSRS…
Vilx-
  • 104,512
  • 87
  • 279
  • 422
316
votes
24 answers

Foreach loop, determine which is the last iteration of the loop

I have a foreach loop and need to execute some logic when the last item is chosen from the List, e.g.: foreach (Item result in Model.Results) { //if current result is the last item in Model.Results //then do something in the code …
mishap
  • 8,176
  • 14
  • 61
  • 92
311
votes
20 answers

"The page you are requesting cannot be served because of the extension configuration." error message

I'm getting this error message when trying to run my application. I don't know how to fix it: HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a…
delete
306
votes
8 answers

Difference Between ViewResult() and ActionResult()

What is the difference between ViewResult() and ActionResult() in ASP.NET MVC? public ViewResult Index() { return View(); } public ActionResult Index() { return View(); }
Domnic
  • 5,227
  • 8
  • 26
  • 27
305
votes
25 answers

How do I enable NuGet Package Restore in Visual Studio?

There's a similar post on stack but it doesn't help with my issue possibly because I am using Visual Studio 2015. How do I get the "Enable NuGet Package Restore" option to appear in VS2015? I chose File > New Project and created an empty ASP.NET Web…
Dan Beaulieu
  • 19,406
  • 19
  • 101
  • 135
304
votes
20 answers

Get the correct week number of a given date

I have Googled a lot and found a lot of solutions, but none of them give me the correct week number for the 2012-12-31. Even the example on MSDN (link) fails. 2012-12-31 is Monday, therefore it should be Week 1, but every method I tried gives me 53.…
Amberlamps
  • 39,180
  • 5
  • 43
  • 53
302
votes
12 answers

How to debug a single thread in Visual Studio?

I have a solution with some projects. There are several break-points in different projects. I want to trace the first thread hit one of these break-points and continue tracing that single thread despite of other threads entering the same…
Xaqron
  • 29,931
  • 42
  • 140
  • 205
300
votes
15 answers

Request format is unrecognized for URL unexpectedly ending in

When consuming a WebService, I got the following error: Request format is unrecognized for URL unexpectedly ending in /myMethodName How can this be solved?
roman m
  • 26,012
  • 31
  • 101
  • 133
300
votes
12 answers

Session lock causes ASP.Net websites to be slow

I just discovered that every request in an ASP.Net web application gets a Session lock at the beginning of a request, and then releases it at the end of the request! In case the implications of this are lost on you, as it was for me at first, this…
James
  • 7,877
  • 7
  • 42
  • 57
297
votes
17 answers

jQuery UI Dialog with ASP.NET button postback

I have a jQuery UI Dialog working great on my ASP.NET page: jQuery(function() { jQuery("#dialog").dialog({ draggable: true, resizable: true, show: 'Transfer', hide: 'Transfer', width: 320, …
Paul
  • 12,359
  • 20
  • 64
  • 101
296
votes
13 answers

Accessing Session Using ASP.NET Web API

I realize session and REST don't exactly go hand in hand but is it not possible to access session state using the new Web API? HttpContext.Current.Session is always null.
Mark
  • 21,067
  • 14
  • 53
  • 71
295
votes
12 answers

Exposing localhost to the internet via tunneling (using ngrok): HTTP error 400: bad request; invalid hostname

From previous versions of the question, there is this: Browse website with ip address rather than localhost, which outlines pretty much what I've done so far...I've got the local IP working. Then I found ngrok, and apparently I don't need to…
Chris
  • 28,822
  • 27
  • 83
  • 158
294
votes
13 answers

How can I connvert a JSON object to a custom C# object?

Is there an easy way to populate my C# object with the JSON object passed via AJAX? This is the JSON object passed to a C# web method from the page using JSON.stringify: { "user": { "name": "asdf", "teamname": "b", …
MHop
  • 3,053
  • 3
  • 17
  • 13
292
votes
53 answers

Hidden Features of ASP.NET

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. More info:…
Vaibhav
  • 11,310
  • 11
  • 51
  • 70