开发者

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. in that page "A2" I have a btn "SAVE & GO to website 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.

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

  开发者_JAVA百科      }

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.


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. Please store the website B with http:// prefix like this.

<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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜