Cassini Modification for Anonymous Access for ASP.NET 3.5
I'm using Cassini to run an ASP.NET app on a machine where I don't have access to IIS. I'm using Cassini for .NET 3.5. My website uses Windows authentication and when run on Cassini
User.Identity.Name
returns an empty string. I'm guess this does this because it is allowing anonymous access to my website. This is documented here:
http://support.microsoft.com/?id=306359
The fix for the problem is:
Change the authentication mode in the Web.config file to Windows as follows:
<authentication mode="Windows" />
- In the Internet Services Manager, right-click the .开发者_如何学编程aspx file or the Web Project folder, and then click Properties.
- If you clicked Properties for the Web Project folder, click the Directory Security tab. 3. If you clicked Properties for the .aspx file, click the File Security tab.
- Under Anonymous Access and authentication control, click Edit.
- In the Authentication methods dialog box, clear the Anonymous Access check box, and then select either the Basic, the Digest or the Integrated (NT Challenge/Response) check box.
Cassini doesn't have a UI to do this, can anyone point me in the right direction to modify to Cassini sourse code such that it doesn't allow Anonymous Access?
I am using the version from this website: http://blogs.msdn.com/dmitryr/archive/2008/10/03/cassini-for-framework-3-5.aspx
You should be able to accomplish this by simply checking the 'ntlm authentication' box on the web property page of your project.
This will send a flag to the VS dev server to require windows authentication and in conjunction with you auth=windows config you should get what you want.
In solution explorer pane select the Web Project and hit F4. (not right click+properties, thats different) - this will show property pane
In properties Pane then set: Windows Authentication: Enable Anonymous Authentication: Disabled
Run your project, Happy Days!
精彩评论