我们试图在我们的PC(Windows 7,IIS 7.5)上的两个应用程序之间使用身份验证,并且一切都很顺利。但问题是,当我们尝试发布这些网站(Windows Web服务器2008年,IIS 7.0)交叉认证不起作用!跨多个应用程序进行身份验证
长invistigation后,我们发现,在下面的代码是第二个站点上发生的错误:
Dim formsCookie As HttpCookie = Request.Cookies(FormsAuthentication.FormsCookieName)
If (formsCookie IsNot Nothing) Then
Else
' always null
我们试图检查pathes这样在后面的代码:
Dim ticket As New FormsAuthenticationTicket(1, smsProfile, DateTime.Now, _
DateTime.Now.AddDays(1), True, AdminSessions.UserObj.Pid, _
FormsAuthentication.FormsCookiePath)
Dim hash As String = FormsAuthentication.Encrypt(ticket)
Dim cookie As New HttpCookie(
FormsAuthentication.FormsCookieName,
hash)
If (ticket.IsPersistent) Then
cookie.Expires = ticket.Expiration
End If
Response.Cookies.Add(cookie)
Response.Redirect(smsPortal)
在web.config中:
<authentication mode="Forms">
<forms name=".ASPXFORMSAUTH" enableCrossAppRedirects="true" domain="mydomain.com.jo" loginUrl="http://..." protection="All" path="/"/>
</authentication>
请告诉我们IIS之间有什么区别本地PC和服务器。
谢谢。
它们是否都发布到同一个域? – 2013-02-21 06:03:43
是在同一个域中,每个域都在独立子域中。 ex:sub1.mydomain.com.jo,sub2.mydomain.com.jo – Ibsuser 2013-02-21 06:08:47
有没有特别的配置? – Ibsuser 2013-02-21 08:24:46