我使用asp.net 3.5 web.config来限制访问,它工作得很好.
<authentication mode="Windows">
<authorization>
<allow users="Bill, John"/>
<deny users="*"/>
</authorization>
Run Code Online (Sandbox Code Playgroud)
未经授权(但已通过身份验证)的用户将被系统错误消息阻止,说明:
Server Error in '/' Application
Access is denied.
Description: An error occurred while .......
Error message 401.2: Unauthorized: Logon failed due to server configuration ...
Run Code Online (Sandbox Code Playgroud)
为了使消息更友好,我取消注释customErrors标志并在项目的根路径中创建GenericErrorPage.htm.
<customErrors mode="On" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
Run Code Online (Sandbox Code Playgroud)
但是,它只是不起作用.我仍然收到系统错误消息而不是我的自定义错误页面.
任何建议将不胜感激.
我有一个程序运行一段时间,一切正常,直到这个奇怪的事情发生.当我将一个数字字符串转换为Single时,我只是无法得到我想要的值.例如:
Convert.ToSingle("11006.954")
返回值11006.9541
Convert.ToSingle("20678.228")
返回值20678.2285
我知道我可以使用Convert.ToDouble修复它,但修改现有系统需要数天时间.我使用的是vs2003 .net 1.1.