Matt Bewers

Matt Bewers

  • NA
  • 1
  • 0

Changing redirected website using Form.Action

Apr 11 2010 6:24 AM
Hi

Within a page of my website, I have HTML <input> text box and button control which, when selected, redirect to the site: http://dx.doi.org

The URL for this site is set in the ASP code page using the tag line:
<form method="post" id="form1" action= "http://dx.doi.org" runat="server">

and I was instructed to do this from another person.

What I want to do is stop the page from redirecting the user to this 'action' site when they interact with other controls on the web page, and when they want to be redirected to another page of within the website and not the DOI Resolver.

I have tried using this snippet of code:
ContextStaticAttribute csa = new ContextStaticAttribute();
form1.Action = csa.Match("doiSubmit") ? "http://dx.doi.org/" : string.Empty;

to set the value of the Form1.Action field to null within the Page_Load method of my site (to redirect to the DOI website when selected and otherwise, setting the value to null) but this doesn't do anything as it only stops the page from being correctly redirected when the HTML input button is selected.

Any suggestions?

Answers (1)