Hello, this question should be fairly basic. I want to control the flow of an ASP.NET page -- if a certain condition is met, I want to write out an error message and stop drawing the page. However, I also want ASP.NET to output correct HTML (i.e. not cut off in the middle). Right now I am doing this:
if (condition != what-i-want) {
Label_Error.Text = "Sorry, you messed up";
return;
}
And the problem with that snippet is that ASP.NET draws the rest of the defined page without cutting off after the error. I really don't want to make the whole page Visible = False
and then undo it when someone is authenticated.
Is there some good way to do this? I have tried Response.End()
but that doesn't output clean HTML (or anything actually, since I'm checking in Page_Load
). I've had similar experiences with Response.Close()
, et al.
Thanks.