How to Redirect one page to another page in ASP.NET

No.of Views2818
Bookmarked0
By RRaveen  On 08 Dec 2010
emailbookmarkadd commentsprint
 

Answer:

There are two methods to implement this

1.    Redirect
2.    Transfer

Response.Redirect()

This method is complete kill the current request and start new request and send to new page. Most of the times ignore this method to navigate one page to another page in within application. if this is best for switch one application to another.
C# code

Response.Redirect("~/home.aspx");// this is only redirect to home page
Response.Redirect("~/home.aspx",true); // this is redirect to home page and also end current response.

Server. Transfer()

This is best and less resource expensive way to redirect one page to another. You can use this redirect one page to another within application.
C# Code

Server.Transfer("~/interviwquestions/aspnet.aspx");// this is redirect to asp.net interview questions page within the application
Server.Transfer(HelpHandler, true); // this is use httphandler to redirect
Server.Transfer("~/sub/page.aspx", true); // this use the page with preserver form

 

 
 
About Author
 
RRaveen
Occupation-Software Engineer
Company-TGS
Member Type-Gold
Location-Singapore
Joined date-03 Jun 2009
Home Page-codegain.com
Blog Page-www.codegain.com
- B.Sc. degree in Computer Science. - 4+ years experience in Visual C#.net and VB.net - Obsessed in OOP style design and programming. - Designing and developing Network security tools. - Designing and developing a client/server application for sharing files among users in a way other than FTP protocol. - Designing and implementing GSM gateway applications and bulk messaging. - Windows Mobile and Symbian Programming - Having knowledge with ERP solutions
 
 
Other popular Interview Questions On ASP.NET
^ Scroll to Top