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?
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.
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).
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.
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 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With