Friday, February 11, 2011

Yield: Button redirection

Sometimes it is necessary to provide a way to get from one web page to another. Normally this is done with links, but sometimes you might come across a situation where you need to do this from within your code.

This can be accomplished in ASP.NET by using the "Response" property of the current web form. Keep in mind that the "Response" property is just a System.Web.HttpResponse(), and this means that anything we could do with the System.Web.HttpResponse(), we can do with the "Response" property of our web form.

Linking to an external web page using the "Response" property of the web form:
  1. Response.Redirect("http://ibreakcode.blogspot.com")

Linking to an internal web page using the "Response" property of the web form:
  1. Response.Redirect("Default2.aspx")

And thats about all there is to that.

No comments:

Post a Comment

I Break Code Where code gets done.
ASP.NET | HTML | SQL Server | VB.NET | Request A Topic |