How to Make an Application Offline in ASP.NET 2.0
page 3 of 5
by SANJIT SIL
Feedback
Average Rating: 
Views (Total / Last 10 Days): 27618/ 42

Using <httpRuntime>

The <httpRuntime> section configures some run time parameters for the ASP.NET pipeline. One attribute in the <httpRuntime> element is enabled, which indicates whether the AppDomain is enabled to accept an incoming request. The default value is "true," but we can override the default value in Web.config. By setting this value to "false," the application is not loaded in memory and any request entering the ASP.NET engine for the application will return the default ASP.NET 404 error status page. It should be noted that any requests not handled by the ASP.NET engine (images files, CSS files, static HTML pages, and so on) will return the normal way. Only ASP.NET resources will report a 404 status. To illustrate the same we can set the value false for <httpRuntime> in order to make the application offline. The following code snippet in applicaiton's Web.config is showing the same.

Listing 1

<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
      <httpRuntime enable="false" />
    </system.web>
</configuration>

Once the abovementioned change has been made, users will get the standard ASP.NET 404 error message for requesting any ASP.NET resource.

Figure 2


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-26 7:49:27 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search