Page flow | Forwarding to different pages


I'm from J2EE background. I have a use case something like below, but I'm not sure what's the best way to implement it in ASP.NET.

1) User submits a form (Page1.aspx) by clicking on a link (or a button).

2) At the server, "on_click" of the link/button should invoke some business logic. Depending on the outcome of business logic, request can be forwarded to (not redirect), lets say, 3 different pages:

     a) Page1.aspx itself. (This may happen e.g. if business validation fails on the submitted page)

     b) Page2.aspx. (E.g. if the user is an admin then he should go to a different page than a normal user) 

     c) Page3.aspx. (E.g. lets say this is a normal case)


E.g. in J2EE/JSF this can be done by defining an "action" handler for the button in some managed bean. Depending on the outcome of business logic, this action handler can then return different viewIDs  which can be mapped to different views in faces-config.xml. Request runs on server (unless the navigation rule uses <redirect/>). How can I achieve similar stuff with ASP.NET.

Thanks in advance,


7/13/2008 1:48:28 PM 93655 articles. 6 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 20

you can do it in many ways..for example on clcik event of button..try this code...


       protected void Button1_Click(object sender, EventArgs e)
            int i = 14;  // depending on business validation assign a value

            if (i == 12)  //If business validation fails

            else if (i == 13)  //trasfer to Admin page
            else if (i == 14)  //Normal case


My Blog

"Don't be afraid to be wrong; otherwise you'll never be right."
7/13/2008 2:24:56 PM

Thanks for the quick reply! If I understand it correct then I think Response.Redirect() in ASP.NET would result in a round-trip to the client (i.e. it sends a redirect header back to the client). I'm looking for some mechanism similar to RequestDispatcher.forward() in J2EE, which basically routes the same request to a different resource on the server without incurring the cost of a redirect. Please let me know how to achieve this.



7/13/2008 5:20:41 PM

Use Server.Transfer(), which does not require a round-trip to the server. Do note that using Server.Transfer(); hower, you can't redirect to an external page. Only to pages within the same site. Also Server.Transfer() maintains the same url.

My Blog

(Please MARK this post as ANSWERED, if you find it helpful)
7/13/2008 5:46:49 PM

Thanks this is helpful!

7/13/2008 6:23:56 PM

Similar Artilces:

Can my web page with a form submit to other web pages forms?
I was wondering if I created an aspx page that had a form on it that I could use the submit button to submit this form's contents to other web pages forms(servers accepting those form's data). I am thinking this would be a great way to update data on particular web pages without having to actually visit those similar web pages. Any ideas, examples would be much appreciated. Thanks in advance.  Yes you can.  It's called Cross Page Posting: might ...

Paging Paging Paging
I am trying to do paging with my search results and it isnt working very well. Here is what I've tried and I feel I've tried everything, lol, please help me out. Sub DataGrid1_SortCommand(Sender as object, e as DataGridSortCOmmandEventArgs) DataGrid1.DataBind() End Sub Sub Datagrid1_PageIndexChanged(Sender as object, e as DataGridPageChangedEventArgs) Dim ds as dataSet DataGrid1.CurrentPageIndex = e.NewPageIndex if Session("Search") is nothing then 'Session probably has expired, get the datasource from database Datagrid1.DataSource = ...

how to open a web page in form of a popup web page
Hello, I have two web pages, let say. Page A : With a Button on it. PAge B: with some info. Now I need to: When I click on the Button of page A.Page B must open in a pop up window.  I can do this but problem is this when I clicked on the button for first time it does not show me any thing and when I clicked on the button for second time then It shows me Page B .My code is as follow:  1 protected void Page_Load(object sender, EventArgs e) 2 { 3 if (!this.Page.IsPostBack) 4 { 5 6 } 7 else 8...

How to preserve values in a web form when navigating to a different page and then going back to the original page using the back button ?
   I am working on a C#/ASP.NET web application. The web application basically consist of 3 web forms. Each form contains several controls such as an edit box, and some drop down list box controls. Basically I need to find out how to preserve the values in a web form when a person navigates to a different page. For example, suppose that in my web application I navigate from my first page (First.aspx) to my second page (Second.aspx). Now if I press the browsers back button, I want the application to retain the values for the controls that were in my first web form "first....

A page can have only one server-side Form tag
I have a web user control in my web page.  The user control (ascx) consist of a text box and button. The web page consist of text boxes and buttons also.  Both pages have form tags with runat=server.  When I run the web page it comes up with the error "A page can have only one server-side Form tag." Both the user control and web page need the form tag with runat=server.  Is there a way I can code these pages where there won't be a conflict between the web user control and the web page? Thanks   JohnMo wrote:Both the user control and web page need the form tag wit...

how to navigate the url page in one web application page to another web application page
In my project one solution have 2 web apllications in one 1.webapplication1 2.webapplication2. in firt webapplication1 i created one aspx page like sample.axpx. in second webapplication2 i created one aspx page like sample2.aspx... in sample2.aspx page have hyperlinl. I need to navigate this hyperlink when i click it go to the sample.axpx. how can i write navigate url for me. ..thanks  As i understand u, you need Multi Project soltuionsee this link,

Could PB .NET Web Form POST security Information to others web page??
This is a multi-part message in MIME format. ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: quoted-printable Hi,=20 Have anyone came across the requesion to POST security informations from = PB .NET web form web page to other web site?? I have tried many datys, Could any kind man give me some suggessions?? thanks & Best regards Leon ------=_NextPart_000_00F9_01C9C4D5.8FB45C90 Content-Type: text/html; charset="big5" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML P...

How to display part of a web page inside a different page
Here's what I'm trying to do:  On my web site, I want to create a page (or possibly part of a page, or just a table, if tha'ts possible) that contains some interesting information about a company.  Call this thing "Part A". Then, I'd like to give an HTML snippet to the company, which they can include in their home page, which will display "Part A" from above, from my web site directly on their home page, maybe inside a table or a frame or whatever. Keep in mind the company may not be using .Net, their page may just be HTML... Is this possibl...

Web page opens second web page, how does first page know when the second one closes?
I have an app written in ASP.NET where one of the web pages opens up a web page in a second window.  When this second web page closes, the first web page needs to update its data.  How do you do this? You can have the child window call a parent method when the user clicks a link to close it. Otherwise, you'd have to set up polling to check for the existence of the child, and refresh if it doesn't exist. Please Mark As Answer posts that helped you."If we learn from our mistakes, I should be brilliant by now." Thanks, this gives me part of the answer...

How to pass the form contents of aspx page in .Net to Jsp page
Hi,   I want to pass the login information from aspx page to jsp page. plz help me how to do it. Please reply asap. Thanks...

link a web page to another web page?
I have a web page with my banner and buttons for my site on it. I want to add this to all of my pages. Instead of copying a pasting that to every page. Is there a way i can link the pages to the banner page? Thanx use ascx?:) Or you could create a template page. That is: Create a page inherited from System.Web.UI.Page and place your banner and buttons in this and then have all your other pages inherit tis custom page instead of System.Web.UI.Page. ...

page up / page down
Name: Kyle Morrison Email: Product: Deer Park Summary: page up / page down Comments: page up and page down do not work mac osx 10.3.9 Browser Details: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+ ...

Different Login Pages for different secured pages.
Hi, I'm using Forms authentication. On the admin pages, I want an unauthorised user to be sent straight to the login.aspx, but on 1 page (not within the admin section) I'm using the <location path="~/ImageView.aspx"> element and I want an unauthorised user to be sent to the "~/mustlogin.aspx" as this will display further information to the user. Is there a way to do it???   Multiple config files, all named Web.config, can appear in multiple directories. Each Web.config file applies settings to it's own directory and all children directories...

Page To Page
Hi How can i call to a Text that has been written in a different page(in a TextBox). I want to call him to make a SELECT quastion. Thank's....

Web resources about - Page flow | Forwarding to different pages -

Forwarding plane - Wikipedia, the free encyclopedia
In routing , the forwarding plane , sometimes called the data plane , defines the part of the router architecture that decides what to do with ...

Facebook Messenger For IOS Adds Groups, Message Forwarding
Facebook released version 4.0 of its Messenger application for iOS , and the major additions were the ability to create groups , and the ability ...

Choice urges IP spoofing for better IT prices - Parliament, House, prices, iTunes, guide, US forwarding ...
Consumers should spoof their IP address and use US forwarding addresses to beat high IT prices in Australia, consumer advocacy group Choice said. ...

Martin Taupau email mix-up highlights legal risks of forwarding misdirected message
An incredible email mix-up gave a Canadian theatre critic a cracking NRL scoop &ndash; and potentially a legal headache.

VPN Routing & Forwarding Instance_网络子站_IT专家网
VRF-VPN路由转发实例(VPN Routing & Forwarding Instance) VPN Routing & Forwarding Instance

Facebook Messenger For IOS Adds Groups, Message Forwarding - SocialTimes
Facebook released version 4.0 of its Messenger application for iOS , and the major additions were the ability to create groups , and the ability ...

Call forwarding not working on Project Fi? It's not just you, and there's a fix
If you're using Project Fi, you may have recently noticed incoming calls no longer forwarding to your non-Fi phones as you had previously set ...

Facebook Messenger 4.0 Features Easy Group Creation And Message Forwarding
... , its messaging-focused app, to version 4.0 on iOS. Facebook Messenger 4.0 introduces a couple of significant new features: groups and forwarding. ...

Resources last updated: 11/23/2015 2:23:53 PM