2011-12-19 61 views
0

我在4.0(我的第一次)开发了一个应用程序,并且我只有2个页面。我部署它,它工作正常,如果我输入www.mytestapp.com/testpage.aspx在.net 4.0中的web.config

但是,如果我只是键入mytestapp.com它重定向到www.mytestapp.com/Account/Login.aspx?ReturnUrl =%2f

我认为这是因为我在我的web.config文件中有下面几行。但是,当我注释掉这些行和部署代码

<authentication mode="Forms"> 
    <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> 
    </authentication> 

,如果我键入www.mytestapp.com/testpage.aspx它问我用户名和密码。

我该如何解决这个问题?我怎样才能使应用程序去默认testpage.aspx没有要求任何用户名和密码?

回答

0

对于ASP.net Session和FormAuthentication cookie生成的HttpCookie存在问题。 Web.Config把这个

<system.Web> 
    <httpCookies domain=".mytestapp.com" /> 
</system.web> 
+0

它没有奏效。我尝试添加并注释部分(没有工作),添加并保留部分。 (也没有工作) – SmilingLily 2011-12-19 16:40:29

+0

谢谢你的答复。 – SmilingLily 2011-12-19 16:40:57

+1

这是第一部分 1.更改aspnet_sessionid cookie http://stackoverflow.com/questions/2326521/asp-net-session-cookies-specifying-the-base-domain – dotnetstep 2011-12-19 16:51:21