我有建立在一个简单的身份验证模式网站。它运行良好本地和本地IIS,但在测试服务器中键入正确的凭据,这毕竟不是重定向到默认页面。
I have a website built on a simple authentication model. It runs fine locally and on local IIS, but it is not redirecting to the default page after typing in the correct credentials, all this in the test server.
在code去如下:
的的Web.config 的
<compilation targetFramework="4.0" /> <httpRuntime maxRequestLength="50000" /> <customErrors mode="On" defaultRedirect="exc/exc.aspx?e=1"> <error statusCode="404" redirect="exc/404.aspx?e=404"/> </customErrors> <authentication mode="Forms"> <forms loginUrl="admin/login.aspx" defaultUrl="admin/main.aspx" /> </authentication> <authorization> <allow users="*" /> </authorization> </system.web> <location path="admin"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> </location> <location path="admin/css/cms.css"> <system.web> <authorization> <allow users="?"/> </authorization> </system.web> </location> <location path="admin/css/styles.css"> <system.web> <authorization> <allow users="?"/> </authorization> </system.web> </location> <location path="admin/images"> <system.web> <authorization> <allow users="?"/> </authorization> </system.web> </location> <location path="exc/exc.aspx"> <system.web> <authorization> <allow users="?"/> </authorization> </system.web> </location>的的login.aspx 的
该表单action属性是空白的,AutoEventWireup是真实的。
The form action property is blank and AutoEventWireup is true.
的 login.aspx.cs 的
protected void btnAuth_Click1(object sender, EventArgs e) { //Some code not shown... //User Validation ValidateUserResponse response = new ValidateUserResponse(); response = service.ValidateUser(request); if (response.State == true) FormsAuthentication.RedirectFromLoginPage(request.Alias, False); }的 SignOut 的
protected void Page_Load(object sender, EventArgs e) { FormsAuthentication.SignOut(); Response.Redirect(FormsAuthentication.LoginUrl); }在测试服务器的URL看起来是这样的:
On the test server the URL looks something like this:
192.168.1.58/TestSite/admin/login.aspx在VS2010运作良好,以及在一次发表了我的本地IIS,但不明白为什么在TESTSERVER公布时,不登录后重定向到默认页面。显示了的网站需要登录和一个403 Forbidden错误的。
On VS2010 works well as well on my local IIS once published, but don't understand why isn't redirecting to the default page after the login when published on the TestServer. Showing that the website requires to log in and a 403 forbidden error.
本地我与这两个网址的形式和作品进行了测试(虚拟文件夹名称不同):
Locally I have tested it with both URL forms and works (the virtual folder name is different):
192.168.1.58/TestSite1/admin/login.aspx localhost/TestSite1/admin/login.aspx我AP preciate对此事的任何建议,使其工作。
I'd appreciate any suggestions on the matter to make it work.
感谢您。
---------- -----------更新
我解决了这个问题是这样的:
I solved the problem this way:
本作在web.config中的WebForms身份验证设置开始有对Web应用程序的影响。
This made the WebForms Authentication settings on Web.Config to start having effect on the WebApp.
感谢您。
推荐答案请确保窗体身份验证在IIS中启用了Web服务器上。
Make sure forms authentication is enabled in IIS on the web server.
更多推荐
简单的表单验证网站登录后不重定向
发布评论