ASP.NET powers websites. It generates and serves web pages in cooperation with the IIS web server.
It tests requests,
and sends them to visitors.
File types. ASP.NET projects have different file types. Many websites use ASPX files—these represent pages. But we also have ASHX files—these are simple handlers.ASHX
Write. With ASP.NET we receive a request from the web browser over the network. We then generate a response to send back. Several methods are available.WriteWriteFileBinaryWriteWriteFile, ImageOutputStreamCompleteRequest
Razor syntax. With new versions of Visual Studio, we can write HTML directly inline with C# code. This makes it easier to create ASP.NET pages. Character escapes are not needed.Razor Syntax
HttpContext. This type is essential to ASP.NET development. It provides functionality related to the HTTP protocol. It is needed in many projects.HttpContext.RequestTimestampLocalhost
Tracing is an easy way to build diagnostics and timings into a website. It is also easy to disable if we need more performance from a site. It is an effective diagnostic mechanism.Trace
Files. How can we handle files on the local disk on an ASP.NET website? We use File.AppendAllLines. This example implements a logging mechanism that records visits.Files
Paths. Often the path received from the client on the network is not the same as the path on the local server. In ASP.NET we dynamically rewrite paths.RewritePathurlMappingsServer.TransferGlobal.asaxMapPathPhysicalApplicationPath
Query. When we access an ASP.NET website with a query string in the URL, such as page.aspx?test=1, the QueryString collection may be used to access the "test" value.QueryStringParse Queries
Caching is a large part of performance. It is perhaps the largest part. We focus on improving website performance with caches—on both the client and server.HTTP Cache HeadersSetCacheabilityCache ExpirationOutput Cache
Global variables. There are several ways we can use global variables in ASP.NET websites. This can make projects much easier to develop.Global Variables
HTTP headers are an instrumental part of the web. Client software sends requests in HTTP header format. A web server must respond with the appropriate HTTP response headers.ContentTypeRedirect, RedirectPermanentRequest.HeadersIP AddressServerVariablesHttpWorkerRequest
With AJAX, we update pages on the client-side without needing to change the entire page. We update parts of pages. Here we tie the Page_Load event to the AJAX technique.Page_Load
Configuring an ASP.NET website is frustrating. These examples span several configuration topics.
We change error outputs,
how sites are compiled,
what modules are loaded,
Web applications. I found that a web application is slightly more efficient than a website project. Fewer checks are needed for requests.Web Applications
Web Forms. These enable us to quickly create web pages. This feature is object-oriented. It makes web page generation code easier to maintain and improve.
Controls in Web Forms. Controls are used to represent page elements. We can insert plain text into a website using the ASP.NET Literal markup or the LiteralControl element.asp LiteralLiteralControlHtmlLinkHtmlMetaSiteMap
Properties. The ID of any element can be removed. We set the ID to null to do this. Visible enables us to use a template and remove or add elements from it without creating them in code.Remove IDVisible
Master pages separate the template from more specific content sections. We describe this separation model in more depth. We compare it to alternative models.Master Pages
Misc. These tutorials cover many aspects of web development. Server-side comments can be used to remove text from pages before they are sent, reducing page sizes.Server-Side CommentsServer-Side Includes
Tools. Amazon CloudFront is used to host the pages on this website. In the past, I used Fiddler to test its pages. I also developed an ASP.NET .bat file to locally run pages.Amazon CloudFrontFiddlerASP.NET Development, bat
ASP.NET is not needed for static pages. A regular C# program can generate them. But for handling requests, and reading from external data sources, ASP.NET is ideal.