Asp.net 启用跨应用程序重定向
我们在两台web服务器上设置了负载平衡,但是,当一些用户被重新定向到特定服务器以上载文档时,他们会被要求登录(我们尝试将所有上载的文档仅保留在一台服务器上),下面是web.config中的代码:Asp.net 启用跨应用程序重定向,asp.net,authentication,membership,umbraco,Asp.net,Authentication,Membership,Umbraco,我们在两台web服务器上设置了负载平衡,但是,当一些用户被重新定向到特定服务器以上载文档时,他们会被要求登录(我们尝试将所有上载的文档仅保留在一台服务器上),下面是web.config中的代码: <authentication mode="Forms"> <forms name="EAAAuthCookie" loginUrl="/login" defaultUrl="/members/home" protection="All"
<authentication mode="Forms">
<forms name="EAAAuthCookie"
loginUrl="/login"
defaultUrl="/members/home"
protection="All"
path="/"
timeout="60000"
slidingExpiration="true"
enableCrossAppRedirects="true" />
</authentication>
<machineKey
decryption="AES"
validation="SHA1"
decryptionKey="key"
validationKey="key" />
以下是上传表单的传输代码:
$('#addReport').click(function() {
if ($.cookie('TransferURL') != '')
{
$("#iframeUploadReport").attr('src', $.cookie('TransferURL'));
};
$('#overlay').fadeIn('slow');
});
<script type="text/C#" runat="server">
void Page_Load()
{
string cookieName = FormsAuthentication.FormsCookieName;
string userName = Request.Cookies["HiddenUsername"].ToString();
string cookieValue = FormsAuthentication.GetAuthCookie(userName, false).Value;
Response.Cookies["TransferURL"].Value = "/members/media-upload" + String.Format("?{0}={1}", cookieName, cookieValue);
}
</script>
<iframe id="iframeUploadReport" src="/members/media-upload" width="500px" height="336px" frameborder="0" scrolling="no"></iframe>
$('#addReport')。单击(函数(){
if($.cookie('TransferURL')!=“”)
{
$(“#iframeUploadReport”).attr('src',$.cookie('TransferURL');
};
$('#overlay').fadeIn('slow');
});
无效页面加载()
{
字符串cookieName=FormsAuthentication.FormsCookieName;
字符串userName=Request.Cookies[“HiddenUsername”].ToString();
字符串cookieValue=FormsAuthentication.GetAuthCookie(用户名,false).Value;
Response.Cookies[“TransferURL”].Value=“/members/media upload”+String.Format(“?{0}={1}”,cookieName,cookieValue);
}
你能看到我们缺少的任何明显的步骤吗
谢谢请参阅
要使表单身份验证在负载平衡的环境中工作,需要使两个应用程序使用相同的机器密钥。只需按照链接中的说明操作即可