2011-12-19 64 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