2011-07-12 136 views
53

我可以更改FormsAuthentication cookie名称吗?我可以更改FormsAuthentication cookie名称吗?

如果是,如何?

我得到的问题是,当我有两个Web应用程序部署在同一个域中,然后当任何人登录时,第二个会自动注销,因为他们使用相同的身份验证的cookie名称。

+1

重复的问题:http://stackoverflow.com/questions/3631617/how-do-i-customize-the-forms-authentication-cookie-name – DaveRead

回答

78

您可以在web.config文件中进行调整:

<authentication mode="Forms"> 
    <forms name=".CookieName" loginUrl="LoginPage.aspx" /> 
</authentication> 
+25

的人谁在这一点疑惑,默认cookie名称是“.ASPXAUTH” –

12

是的,你可以在web.configforms元素下authentication元素指定cookie名称。

<authentication mode="Forms"> 
    <forms name="RoleBasedAuthenticationCookiename" loginUrl="~/Login.aspx" defaultUrl="~/Default.aspx"> 
    </forms> 
</authentication> 
相关问题