我的webapp上有2个页面。 Login.aspx和Main.aspx。
成功的登录用户名和密码后,我从login.aspx重定向到Main.aspx,如下c#所示。
在Visual Studio 2010中可以正常工作。
问题是,当我部署网站时,值localhost没有任何意义。
我可以确定网站正在运行的服务器名称,还是应该以某种方式将服务器重定向主页链接放在我的web.config文件中?
谢谢
达摩
string Redirectport = HttpContext.Current.Request.ServerVariables["SERVER_PORT"];
RedirectURL = "http://localhost:" + Redirectport + System.Web.HttpContext.Current.Response.ApplyAppPathModifier("~/Main.aspx");
最佳答案
怎么样RedirectURL = Page.ResolveUrl("~/Main.aspx")
吗?
这是执行此操作的“默认”方法。
关于c# - ASP.NET从登录重定向到主页,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12848152/