简体   繁体   English

ASP.net 应用程序登录后绕过IIS.net 网页

[英]ASP.net application detours off to the IIS.net web page after login

I have developed an asp application in Visual Studio and have installed it on a server machine.我在 Visual Studio 中开发了一个 asp 应用程序并将其安装在服务器机器上。 This is an intranet application, meant only for clients in the office network.这是一个 Intranet 应用程序,仅适用于办公网络中的客户端。 It runs under IIS on the server machine.它在服务器计算机上的 IIS 下运行。

The application works fine in my development environment and has been installed and was in limited use by a few users, and worked fine there as well.该应用程序在我的开发环境中运行良好,并且已经安装并且被少数用户有限使用,并且在那里也运行良好。 When started, the application displays a sign on/password screen, then continues on to the default page (basically, a main menu type page.)启动时,应用程序显示登录/密码屏幕,然后继续到默认页面(基本上,主菜单类型页面。)

As I'm expanding the user base to include the rest of the people in the office, I have found that, inexplicably (to me) on some of the machines the program displays the sign on/password screen, but instead of continuing on to the default page it shows the IIS.net Welcome page (the word 'welcome' displayed in many different languages), then goes to the IIS.net default web page.当我扩大用户群以包括办公室的其他人时,我发现,在某些机器上(对我而言)莫名其妙地程序显示了登录/密码屏幕,而不是继续默认页面显示 IIS.net 欢迎页面(“欢迎”一词以多种不同语言显示),然后转到 IIS.net 默认网页。

I'm at a loss for where to look to solve the problem.我不知道在哪里寻找解决问题的方法。 I don't know what code I could include to look for an error.我不知道可以包含哪些代码来查找错误。 If I had to guess, I would think this was a problem somewhere on the client machines, but I don't know for sure, and I don't know where to look.如果我不得不猜测,我会认为这是客户端机器上某个地方的问题,但我不确定,也不知道去哪里找。

Any help or suggestions would be appreciated.任何帮助或建议将不胜感激。

Well, after much hunting around, I came up with not necessarily the solution to my problem, but at least a work-around.好吧,经过多次摸索,我想出的不一定是我的问题的解决方案,但至少是一种解决方法。

I am using Forms Authentication.我正在使用表单身份验证。 In my web.config file is the following:在我的 web.config 文件中如下:

<authentication mode="Forms">
  <forms name="CustCookie" loginUrl="~/Login.aspx" protection="All" timeout="30" path="/"/>
</authentication>

I took the logic for the login page from something I read somewhere, and have this statement in my login program:我从我在某处阅读的内容中获取了登录页面的逻辑,并在我的登录程序中包含了以下语句:

FormsAuthentication.RedirectFromLoginPage(Login1.UserName, Login1.RememberMeSet)

where the login screen has a UserName text box and a box to check for 'Remember Me' (which I have disabled because I didn't want a Remember Me option right now.)登录屏幕有一个用户名文本框和一个框来检查“记住我”(我已禁用,因为我现在不想要“记住我”选项。)

I put in some code to allow me to see what was happening:我输入了一些代码来让我看看发生了什么:

Dim m_url As String = FormsAuthentication.GetRedirectUrl(RptObj.User.UserName, False) Dim m_url As String = FormsAuthentication.GetRedirectUrl(RptObj.User.UserName, False)

and found that for some users the url was coming back fine while for others all I got was '/', which was causing it to reroute to the IIS main page.并发现对于某些用户,url 恢复正常,而对于其他用户,我得到的只是“/”,这导致它重新路由到 IIS 主页。 I added a 'defaultUrl="~/default.aspx"' to my web.config forms line, but that didn't solve it, so I added the following to my login program:我在我的 web.config 表单行中添加了一个 'defaultUrl="~/default.aspx"',但这并没有解决它,所以我在我的登录程序中添加了以下内容:

            Dim m_url As String = FormsAuthentication.GetRedirectUrl(RptObj.User.UserName, False)
            If m_url = "/" Then
                Server.Transfer("~/default.aspx")
            Else
                FormsAuthentication.RedirectFromLoginPage(Login1.UserName, Login1.RememberMeSet)
            End If

Not a very elegant way to get the job done in my mind, but it worked.在我看来,这不是一种非常优雅的完成工作的方式,但它奏效了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Asp.Net Web应用程序的登录页面 - Login Page for Asp.Net Web Application 在IIS7中发布asp.net Web应用程序后无法登录 - Cannot login after I publish my asp.net web application in IIS7 在IIS中托管一个ASP.NET Web应用程序 - Host an asp.net web application in IIS 大约15分钟后,asp.net Web应用程序将进入登录页面 - asp.net web application goes to login page after about 15 minutes 从登录重定向后,ASP.NET WEB窗体应用程序未输入Page_Load - ASP.NET WEb Forms application does not enter Page_Load after redirection from login ASP.NET应用程序的ASP登录页面 - ASP Login page for ASP.NET Application 有没有一种方法可以在不影响用户的情况下在IIS 7上部署新编译的ASP.NET Web应用程序代码? - Is there a way to deploy newly compiled ASP.NET web application code on IIS 7 without kicking users off? IIS 7.5下的ASP Net Web应用程序重定向到登录页面,但登录后出现错误http 404.0 - asp net web application under IIS 7.5 redirect to a login page but gives error http 404.0 after log-in 在将IIS“嵌套”应用程序部署到主网站后,第二个ASP.NET Web应用程序挂起 - a second ASP.NET web app hangs after deployed as IIS 'nested' Application onto primary web site 在IIS上部署ASP.NET Web应用程序后对** web.config **进行的更改 - Changes to be made to **web.config** after deploying ASP.NET Web Application on IIS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM