how to display response.write in asp.net

fkr picture fkr · May 10, 2014 · Viewed 8.4k times · Source

I'm trying to display response.write function after user completes registration form.

I've done it like this, but it doesn't work. I already tried both ways, still nothing has changed.

Response.Redirect("Login");
Response.Write("Registration successful!");

By it "doesn't work" i mean the "registration successful" never shows up.

I will appreciate any help. Thank you!

Answer

Sani Singh Huttunen picture Sani Singh Huttunen · May 10, 2014

Since you Redirect then any Write after that will simply not happen.
With Redirect execution is redirected to another page.

To display the message and then redirect you could add a HTML header in the response. Something like this will show the message, delay 3 seconds and then redirect.:

Response.Write("Registration successfull!");
Response.AddHeader("REFRESH","3;URL=Login");