1
我试图使用相同的登录表单url验证两个应用程序,所有的应用程序都在同一个域中,但在不同的Web服务器。所以,如果我把所有的应用程序放在同一个网络服务器上,那么完美的工作,但是在不同的服务器上是行不通的。我已经配置了需要认证的两个应用程序的Web配置,这里是我的代码。我无法使用通用登录身份验证身份验证
两个应用程序在web.config文件相同
<forms enableCrossAppRedirects="true" cookieless="UseCookies" loginUrl="http://localhost:90/" />
<machineKey validationKey="[value]" decryptionKey="[value]" validation="SHA1"/>
我登录网站控制器代码:
[HttpPost]
public void Index(string userName, string password)
{
var cookie = FormsAuthentication.GetAuthCookie(userName, false);
var url = Request.QueryString["ReturnUrl"];
//Here I will check the user credentials
if (userName == "usernameX" && password == "passwordX")
{
Response.Redirect(String.Format("{0}?{1}={2}",
Request.QueryString["ReturnUrl"],
FormsAuthentication.FormsCookieName,
cookie.Value));
}
}
难道这是原因吗? ** loginUrl =“http:// localhost:90/**在您的web.config? – Chris 2014-12-04 17:57:56
这只是我的登录页面的网址 – willver 2014-12-04 18:30:50