Search code examples
c#asp.netsqlresponse.write

how to display response.write in asp.net


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!


Solution

  • 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");