0

I've encountered a problem after I fire the submit button, the page redirect to itself. How do I redirect it to another page after submit?

My submit button also have C# code behind it where it uploads the files to the server, creates a folder and sends out an email.

I assume that server side form control (runat=server) is designed to post-back to self...

user3813162
  • 47
  • 2
  • 10
  • If you want the form to submit to another URL, you'll need to get that URL into the form's action. Otherwise you can response.redirect or similar in the eventhandler in your code – Allan S. Hansen Jul 23 '14 at 18:59

3 Answers3

2

Probably a Response.Redirect("PageName.aspx") is what you are looking for.

eduardobr
  • 146
  • 15
1

Response.Redirect("http://...../Default.aspx", false); Context.ApplicationInstance.CompleteRequest();

in order to void this

https://www.jasoft.org/Blog/post/solucionar-el-error-thread-was-being-aborted-en-asp-net

0

You can use PostBackUrl="~/Confirm.aspx"

For example:

In your .aspx file

<asp:Button ID="btnConfirm" runat="server" Text="Confirm" PostBackUrl="~/Confirm.aspx" />

or in your .cs file

btnConfirm.PostBackUrl="~/Confirm.aspx"

https://stackoverflow.com/a/23976700/2067560

iamraviraj
  • 191
  • 3
  • 19