0

Using .Net WebForms c# 4.5,

I have a requirement to post data to a third party and on doing so, the user by redirected to the external site in a new tab in ther browser. Like in this question: How to perform an HTTP POST and redirect the user to an external site?

So, I first of all tried doing a Post via WebClient. I was able to Post to the external site OK and get a html response string back. I want to be redirected to the external site as I would be with a normal form post however. The html response is no good if I render as it contains relative paths etc. I really need to redirect to the external site.

So the logical solution is to have a form on the page with a target="_blank" and an action of the external site. My problem is that I cannot do this as there is already a form which includes the whole page (this can not be changed) and nested forms aren't allowed.

Any suggestions

Community
  • 1
  • 1
Steve Ward
  • 1,207
  • 3
  • 16
  • 42

1 Answers1

0

I can post to the third party by setting the PostBackUrl property on a LinkButton.

My remaining problem is that I want this to open in a new tab but the target="_blank" doesnt do anything here.

<asp:LinkButton ID="hlApplication" runat="server" Text="Start your application" aria-describedby="information" target="_blank" OnClientClick="this.disabled=true;" UseSubmitBehavior="false"/>

hlApplication.PostbackUrl ="http://externalurl";
Steve Ward
  • 1,207
  • 3
  • 16
  • 42