FormsAuthentication.CookieDomain property

ぐ巨炮叔叔 提交于 2019-12-08 03:17:16

问题



Q1

FormsAuthentication.CookieDomain property specifies the domain for which this cookie is valid. Overriding this property is useful if you want to enable the cookie to be used for more applications on your web server

A) I assume the quote is suggesting that if same browser is used to log onto two web applications, then overriding this property will cause these two applications to put their tickets into same authentication cookie?

B) Doesn’t above quote imply that if we only have one Asp.Net application running on our web server, then we don’t need to overwrite the default value (which is an empty string)?

But as far as I know, even if we only have one Asp.Net application running on our web server, we would still need to set this property to a value representing our domain, else forms authentication would not work?!


回答1:


Correct. You don't need to override the value if you only have one application, but you don't need to set it either, it is worked out for you.

Really this is for situations where you may have one application on http://www.example.com and one on http://host1.example.com - setting the cookie domain to example.com means they will share the same cookie.



来源:https://stackoverflow.com/questions/875647/formsauthentication-cookiedomain-property

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!