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
402
votes
10 answers

How to get current page URL in MVC 3

I am using the Facebook comments plugin on a blog I am building. It has some FBXML tags that are interpreted by the facebook javascript that is referenced on the page. This all works fine, but I have to pass in the current, fully-qualified URL to…
CatDadCode
  • 58,507
  • 61
  • 212
  • 318
395
votes
22 answers

"The Controls collection cannot be modified because the control contains code blocks"

I am trying to create a simple user control that is a slider. When I add a AjaxToolkit SliderExtender to the user control I get this (*&$#()@# error: Server Error in '/' Application. The Controls collection cannot be modified because the control…
Daniel P
  • 4,217
  • 3
  • 21
  • 15
394
votes
27 answers

Can I automatically increment the file build version when using Visual Studio?

I was just wondering how I could automatically increment the build (and version?) of my files using Visual Studio (2005). If I look up the properties of say C:\Windows\notepad.exe, the Version tab gives "File version: 5.1.2600.2180". I would like…
Ian G
  • 29,468
  • 21
  • 78
  • 92
393
votes
11 answers

Response Content type as CSV

I need to send a CSV file in HTTP response. How can I set the output response as CSV format? This is not working: Response.ContentType = "application/CSV";
balaweblog
  • 14,982
  • 28
  • 73
  • 95
381
votes
14 answers

Where does Console.WriteLine go in ASP.NET?

In a J2EE application (like one running in WebSphere), when I use System.out.println(), my text goes to standard out, which is mapped to a file by the WebSphere admin console. In an ASP.NET application (like one running in IIS), where does the…
Kevin Hakanson
  • 41,386
  • 23
  • 126
  • 155
379
votes
23 answers

Injecting content into specific sections from a partial view ASP.NET MVC 3 with Razor View Engine

I have this section defined in my _Layout.cshtml @RenderSection("Scripts", false) I can easily use it from a view: @section Scripts { @*Stuff comes here*@ } What I'm struggling with is how to get some content injected inside this section…
tugberk
  • 57,477
  • 67
  • 243
  • 335
352
votes
4 answers

How to explain Katana and OWIN in simple words and uses?

I have read many articles about the OWIN and Katana projects, but I could not get the whole picture of it. For a normal web developer who uses ASP.NET: What exactly is OWIN and what problems does it solve (in simple words). What is its relation to…
ebram khalil
  • 8,252
  • 7
  • 42
  • 60
346
votes
8 answers

Returning binary file from controller in ASP.NET Web API

I'm working on a web service using ASP.NET MVC's new WebAPI that will serve up binary files, mostly .cab and .exe files. The following controller method seems to work, meaning that it returns a file, but it's setting the content type to…
Josh Earl
  • 18,151
  • 15
  • 62
  • 91
346
votes
71 answers

ASP.NET 5 MVC: unable to connect to web server 'IIS Express'

What I'm doing: Opening Visual Studio Community 2015 File -> New -> Project Under Visual C#: Web -> ASP.NET Web Application Web Application And press f5 for the popup error "unable to connect to web server 'IIS Express'." Deleting…
Sarek
  • 3,518
  • 2
  • 10
  • 9
342
votes
28 answers

ASP.NET MVC on IIS 7.5 - Error 403.14 Forbidden

I'm running Windows 7 Ultimate (64 bit) using Visual Studio 2010 RC. I recently decided to have VS run/debug my apps on IIS rather than the dev server that comes with it. However, every time I try to run an MVC app, I get the following error: HTTP…
Omar
  • 39,496
  • 45
  • 145
  • 213
342
votes
50 answers

The breakpoint will not currently be hit. No symbols have been loaded for this document in a Silverlight application

Ok, what I have: Visual Studio 2010 RC, W7 x64, started a new project type of Silverlight application. Hosting the Silverlight application in a ASP.NET Web Application Project. Silverlight Version 3.0. Added a LinqToSQL Class, a WCF Service, a…
Christian Casutt
  • 2,334
  • 4
  • 29
  • 38
339
votes
27 answers

How can I get my webapp's base URL in ASP.NET MVC?

How can I quickly determine what the root URL is for my ASP.NET MVC application? I.e., if IIS is set to serve my application at http://example.com/foo/bar, then I'd like to be able to get that URL in a reliable way that doesn't involve getting the…
Benjamin Pollack
  • 27,594
  • 16
  • 81
  • 105
327
votes
8 answers

WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive)

I'm building a web application using Visual Studio 2012. I'm attempting to add word count into my textbox. However after adding the the javascript codes and the html codes. I receive the error as stated above. Here is my javascript codeds Code :…
Bryan
  • 8,488
  • 14
  • 52
  • 78
326
votes
28 answers

The Web Application Project [...] is configured to use IIS. The Web server [...] could not be found.

I have a web project in my solution file that is "unavailable" when I open the solution. When I right-click on the web project and reload the project, I get the following error: The Web Application Project mycompany.myapp.mywebproject is configured…
dotnet-practitioner
  • 13,968
  • 36
  • 127
  • 200
323
votes
10 answers

Logging best practices

I'd like to get stories on how people are handling tracing and logging in real applications. Here are some questions that might help to explain your answer. Frameworks What frameworks do you…
Paul Stovell
  • 32,377
  • 16
  • 80
  • 108