[英]page redirection on other website with query string
i have a website "A" in which i am login and redirecting to page "A1" there one text box is asking entry code after filling that code there is a btn GO when i press that btn its redirecting to page "A2" based on that entry code all text filed gets fill. 我有一个网站“A”,我在其中登录并重定向到页面“A1”那里有一个文本框在填写该代码后要求输入代码有一个btn GO当我按下那个btn它重定向到页面“A2”基于所有文本字段的输入代码都会填写。 in that page "A2" I have a btn "SAVE & GO to website B" 在那个页面“A2”我有一个btn“SAVE&GO到网站B”
now wht i want to Based on that entry code i want to redirect to "website B" in new browser on save and go to website B btn. 现在我想根据那个条目代码,我想在保存的新浏览器中重定向到“网站B”,然后转到网站B btn。
i am using the code 我正在使用该代码
protected void btnSaveCase_Click(object sender, EventArgs e)
{
Session.Abandon();
Response.Redirect(ConfigurationManager.AppSettings["website B"] + "/Content/CaseProps.aspx?CaseId=" + geturl(CaseId.ToString()));
//Response.Redirect(ConfigurationManager.AppSettings["RCMS"], true);
}
but its not working... 但它不起作用......
can i use some other code?? 我可以使用其他一些代码??
anyone please help me... 有人请帮助我......
Can you try this: 你能试试这个:
Response.Redirect("URL", false);
Response.Redirect(ConfigurationManager.AppSettings["website B"] + "/Content/CaseProps.aspx?CaseId=" + geturl(CaseId.ToString()), false);
By setting it to false
, it will terminate your current request. 通过将其设置为false
,它将终止您当前的请求。
If the error is that the redirect does not take you to website B then its most probably because you are storing the website b in AppSettings
incorrectly. 如果错误是重定向没有带您到网站B,那么很可能是因为您正在错误地将网站b存储在AppSettings
。 Please store the website B with http://
prefix like this. 请将网站B存储为http://
前缀,如下所示。
<add key="website B" value="http://www.websiteb.com"/>
Ok. 好。 So you want to open a new window rather than redirecting. 所以你想打开一个新窗口而不是重定向。 Try this then. 然后尝试这个。
protected void btnSaveCase_Click(object sender, EventArgs e)
{
try
{
Session.Abandon();
string features = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";
string name = "mywindow";
string url = String.Format("{0}/Content/CaseProps.aspx?CaseId={1}",
ConfigurationManager.AppSettings["website B"],
geturl(CaseId.ToString()));
string script = String.Format(@"window.open('{0}','{1}','{2}');",
url,
name,
features);
ClientScript.RegisterStartupScript(typeof(Page), "key", script, true);
}
catch (System.Threading.ThreadAbortException)
{
throw;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
On an unrelated side note, its a good practice to use WebsiteB
instead of website B
in AppSettings
在不相关的附注中,在AppSettings
使用WebsiteB
而不是website B
是一种很好的做法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.