Link to home
Start Free TrialLog in
Avatar of jmestep
jmestep

asked on

redirecting a form to another page after it posts back to itself first

I have a form that has code to collect some email addresses from input boxes, run some code to send a separate email to each of those addresses and then save the addresses to a database. The page posts back to itself now, but they want the customer to end up on a different page. I tried having the form post to page2 instead of page1, and it doesn't send the emails if I do that.
Is there a way to have page1 redirect to page2 after the code is run and the form submitted?
Thanks
ASKER CERTIFIED SOLUTION
Avatar of b0lsc0tt
b0lsc0tt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jmestep
jmestep

ASKER

That worked great, once I put () around the page name. It's a .aspx page, but the code inside of it is more like .asp
Did you have any other questions related to this or did you need more information?  Let me know if you do.

The similarities between ASP and ASP.NET is the language used, vbscript.  I am not very familiar with ASP.NET but agree with what you said that they look alike.

bol
jmestep : you can test a postback if you are using .net quite easily.

<script runat="server">
Sub Page_Load()
  If Page.IsPostBack Then
    do stuff...
    redirect...
  End If
End Sub

Altho, this will require that your form tag also has a runat="server" in it as well for it to work.
Simon.
jmestep,

I'm glad that I could help you with the question you had.  However I think that you accepted my followup comment by accident instead of the comment (http:Q_21885437.html#16898805) that answered your question.  For the benefit of those that read the question in the future it would be good to correct this.  Pinaldave should be able to do that or help you do that.  Otherwise you can post a zero point question in the Community Support topic to get this corrected.  Let me know if you have any questions about this or please reply if there is some reason you do not want the comment I mentioned accepted.

Thank you for the grade, the points and the fun question.

bol