Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why set subStatusCode to -1 in Web.config?

Tags:

Apologies if this is obvious, but I have searched around and am unable to find an answer.

In a .net Web.config file, could anyone tell me what setting the subStatusCode to - 1 does?

<httpErrors errorMode="Custom" existingResponse="Replace">
      <clear />
      <remove statusCode="404" subStatusCode="-1" />
      <error statusCode="404" prefixLanguageFilePath="" path="/Error.aspx" responseMode="ExecuteURL" />
</httpErrors>

My guess is that it means all the 'sub' codes, 404.1, 404.2.. etc?

like image 657
DevDave Avatar asked Aug 15 '12 14:08

DevDave


People also ask

Is Web config mandatory?

Yes, you will be able to run an ASP.NET application without a WEB. CONFIG file in its root folder. If the application doesn't find a WEB. CONFIG file in its root folder, then it will take MACHINE.

What is Web config used for?

A web. config file is a Windows file that lets you customize the way your site or a specific directory on your site behaves. For example, if you place a web. config file in your root directory, it will affect your entire site (www.coolexample.com).

What are IIS error pages?

The <httpErrors> element contains a collection of <error> elements, each of which defines an error message that IIS uses to respond to specific HTTP errors. You can add custom error messages to IIS by adding an <error> element to the <httpErrors> element in the Web. config file for your site, application, or URL.

What is Web config in VB net?

web. config file is an XML-based configuration file used in ASP. NET-based applications to manage various settings that are concerned with the configuration of our website. In this way, we can separate our application logic from configuration logic.


1 Answers

-1 is the default value for the subStatusCode in IIS.

That said, you are removing the element here, so it's just restating the obvious (remove all prior entries for the statusCode).

In this case (with the remove element) it's not needed.

like image 95
casperOne Avatar answered Oct 06 '22 04:10

casperOne