ArticleDirectory
Create a web applicationProgramTo test previous user-defined member providers and role providers.
In the Web. config file, configure Form Verification and set the custom provider correctly (or set it in ASP. NET wat). For example:
<System. Web>
<Authentication Mode= "Forms" />
<Authorization>
<Deny Users= "? "/>
</Authorization>
<Compilation Debug= "True" Targetframework= "4.0" />
<Membership Defaultprovider= "Xmlmembership">
<Providers>
<Add Name= "Xmlmembership" Applicationname= "Testprovider"
Filename= "D: \ testprovider \ users. config" Requiresquestionandanswer= "True"
Type= "Skysoot. providers. xmlmembershipprovider, skysoot. providers"/>
</Providers>
</Membership>
<Rolemanager Enabled= "True" Defaultprovider= "Xmlroles">
<Providers>
<Add Name= "Xmlroles" Applicationname= "Testprovider" Filename= "D: \ testprovider \ roles. config"
Type= "Skysoot. providers. xmlroleprovider, skysoot. providers"/>
</Providers>
</Rolemanager>
</System. Web>
These providers are set to absolute file names and path values. If the relative path is used, the provider tries to create a configuration file in the working directory of the Web server. If your Web account does not have the permission to access this folder, this will cause an exception.
With this configuration, you can also find these providers in ASP. NET wat:
You can also create some roles for testing the website. Of course, you need to set the authorization in the web. config file:
1. Use wat for debugging
To debug through Wat, you only need to start Wat, select "debug"> "attach to process" in Vs, and then select the corresponding web server process. In most cases, when a file-based Web server is used, two processes run, you need to add it to the correct port to use the WAT debugging provider (the port number can be viewed in the browser address bar ).
When you operate Wat, the breakpoint set in the program will be hit correctly, as shown below: