I am trying to develop a simple web part in VS that will pull data from a text box, construct a URL with the data and open a new tab using OnClientClick="aspnetForm.target ='_blank';" and using this on the code behind:

protected void Button1_Click(object sender, EventArgs e)
        String myString = TextBox1.Text;

        Response.Redirect("http://..." + myString + "...");

This works, but it will only work once from my site without a page refresh. What is the best way to either allow multiple redirects without refresh or just simultaneously refresh the page so the user can enter and search a different parameter?

  • This question is borderline to be off topic (remove the webpart part and it is an asp.net question), and I also think it would get more attention on the stackoverflow site – Robert Lindgren Jul 2 '14 at 5:05

you can do:

Server.Transfer("Page2.aspx", true);
  • Thank you, I should have mentioned that the destination URL is an external site. According to this Server.transfer only works on same server/domains. I tested anyways and they are correct. – S0L1D Jul 2 '14 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.