1. Application Authentication, but authentication is not required for individual directories or files
The most common is that the background of a website needs to be verified, but the foreground does not; generally, the login page has a verification code, and the page that generates the verification code does not need to be verified. Otherwise, the verification image cannot be displayed.
Solution: < System . Web >
<! -- Authentication -->
< Authentication Mode = "Forms" >
< Forms Name = ". Myform" Loginurl = "Login. aspx" Timeout = "20" Protection = "All" />
</ Authentication >
< Authorization >
< Deny Users = "? " />
</ Authorization >
</ System. Web >
<! -- Verification Code -->
< Location Path = "Checkcode. aspx" >
< System . Web >
< Authorization >
< Allow Users = "*" />
</ Authorization >
</ System. Web >
</ Location >
Authentication is used to prohibit access by anonymous users, while page checkcode. aspx allows access by all users, that is, authentication is not required.
2. Rewrite (not required) the web. config inheritance
assume that there is Site A in IIS and there is a virtual directory B under Site A. You can enter "ttp: // ip address/"Access to site a, enter http: // ip address/B to Access Site B; and the web in Project B. config first inherits the web of Site. config. If the config of Project A has many settings, such as and , and the config of Project B does not have these settings, the project does not use these settings, however, the Program of B has an error at runtime because it inherits the config of; this is a bit annoying: "I didn't use it at all. Why is it wrong? The file indicating the error is config of A, which can be solved as follows:
the topic pages enableeventvalidation =" false " validaterequest =" false " theme =" default " >
Project B is not required<PagesEnableeventvalidation= "False"Validaterequest= "False"Theme= "">
Leave the topic of B blank; otherwise, the system prompts that the default topic cannot be found during the running of B;
Settings of A httpmodules >
Add name =" sitecache " type =" sitecache " />
httpmodules >
Settings of B (unnecessary items, clear) httpmodules >
clear />
httpmodules >
If a. B is used<Appsettings>
<AddKey= "App"Value= "" />
</Appsettings>
B will prompt that the app has been loaded while running. < Appsettings >
< Remove Name = "App" />
< Add Key = "App" Value = "" />
</ Appsettings >
Or:<Appsettings>
<Clear/>
<AddKey= "App"Value= "" />
</Appsettings>
3. Disable web. config Rewriting
In the preceding example, if the config settings in B must be the same as those in a and cannot be overwritten, the config settings in < Location Path = "B" AllowOverride = "False" >
< System . Web >
< Httpmodules >
< Add Name = "Sitecache" Type = "Sitecache" />
</ Httpmodules >
</ System. Web >
</ Location >
In this case, the