FormsAuthentication.CookieDomain财产财产、FormsAuthentication、CookieDomain

2023-09-04 23:24:53 作者:痴念i

Q1

FormsAuthentication.CookieDomain属性指定此cookie有效的域。如果要启用cookie被应用于更多的Web服务器上覆盖该属性是非常有用的。

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)我假设的报价是在暗示,如果同一个浏览器来登录到两个Web应用程序,然后重写此属性将导致这两个应用程序将他们的票到同一个验证cookie?

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)不高于报价意味着,如果我们只有运行我们的Web服务器上的一个Asp.Net的应用程序,那么我们就不需要覆盖默认值(这是一个空字符串)?

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)?

不过,据我所知,即使我们只有一个Asp.Net的应用我们的网站服务器上运行,我们仍然需要将这个属性设置为一个价值重估presenting我们的域名,否则窗体身份验证就不会工作?!

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?!

推荐答案

正确的。你并不需要重写值,如果你只有一个应用程序,但你并不需要任何设置,它的工作是为你。

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.

这真的是,你可能会对 http://www.example.com 和一个应用程序的情况下一个在 http://host1.example.com - Cookie域设置为example.com意味着他们将共享相同的cookie。

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.