473,605 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Redirect aspx page

Tom
Hi,

I have an index.aspx page which includes top.aspx,
left.aspx, main.aspx and bottom.aspx.

In the left.aspx, there is a login web control -
login.ascx. It keeps session of username and role after
successful login and shows welcome user message and his
shopping cart link.

The page which shows welcome user message and his shopping
cart link called loginsuccess.as cx. Now, I am not sure how
to deal with the redirect page.

Here is the session code in login.ascx:
Expand|Select|Wrap|Line Numbers
  1. case LOGIN_SUCCESS:
  2. Session["UserName"] = UserName;
  3. Session["Role"] = Role;
  4. Response.Redirect("loginsuccess.ascx",true);
  5. break;
  6.  
I want to redirect page to be the same index.aspx which
has the same top.aspx, left.aspx, role.aspx and
bottom.aspx. In the left.aspx and main.aspx pages, I want
login.ascx turns to loginsuccess.as cx and main.aspx to
role.aspx according to the username and role.

How can I do it?

Thanks
Nov 18 '05 #1
3 9846
Tom wrote:
I want to redirect page to be the same index.aspx which
has the same top.aspx, left.aspx, role.aspx and
bottom.aspx. In the left.aspx and main.aspx pages, I want
login.ascx turns to loginsuccess.as cx and main.aspx to
role.aspx according to the username and role.
How can I do it?


Hello Tom,

I assume you're using frames and index.aspx contains the
frameset definitions ? When you redirect, you redirect the
whole browser window, not just the left part, so you have
to redirect to index.aspx. You could pass a parameter like :
Response.Redire ct("index.aspx? Page=role.aspx" ,true);

Then index.aspx has to look at the "Page" URL parameter
to decide which page to load in the main frame.

From Page_Load in left.aspx, you can look at the session
variables to see if the user logged in, if he did,
you hide login.ascx and show loginsuccess.as cx, if he didn't,
you hide loginsuccess.as cx and show login.ascx.

You can also decide to dynamically load ( with LoadControl() )
login.ascx or loginsuccess.as cx instead of hiding and showing.

Another advice would be to stop using frames and use table
cells instead to split up your window in top,bottom,left ,main.
To make the main part scrollable, you can use style="overflow :auto".
When you get rid of frames, you'll see that it's easier to write
web applications, because from the same index.aspx, you can now
easily access controls on all parts of the screen without having
to do ugly redirect tricks.

Best regards,

Eric
Nov 18 '05 #2
Tom
Dear Eric,
You can also decide to dynamically load ( with LoadControl
() ) login.ascx or loginsuccess.as cx instead of hiding and
showing.

Could you tell me some online tutorial or code example for
teaching LoadControl()?

Another advice would be to stop using frames and use table
cells instead to split up your window in
top,bottom,left ,main.
To make the main part scrollable, you can use
style="overflow :auto".

Actually, I did not use frames. I use server side include
and web control. I want the whole page to be scrollable,
but not just the main part.

What do you suggest to maintain a web site which has
constant pages for top, left and bottom if not use server
side include and frames? (and whole page needs to be
scrollable)

Thanks for your kind help

Tom

Nov 18 '05 #3
Hello Tom,

Tom wrote:
Could you tell me some online tutorial or code example for
teaching LoadControl()?
..NET is documented very well, the Microsoft MSDN site
contains lots of information, including articles and
a class library reference in the library section.
The below URL points to a howto for LoadControl.

http://tinyurl.com/wrco

Note that though the example adds the dynamically loaded
control to the Page's Controls collection, you can add it
to any child controls' Controls collection as well.
What do you suggest to maintain a web site which has
constant pages for top, left and bottom if not use server
side include and frames? (and whole page needs to be
scrollable)


The way I did this was by having a single Page with all
the common layout and using UserControls as modules that
were dynamically loaded in the PlaceHolder on the main
section of the Page, depending on the "Page" URL parameter
received by the Page. In my case, the left part of the
Page would contain a PlaceHolder too, and the module
would load the appropriate UserControl there.

So to open the news "Page", the URL would be
http://somehost/index.aspx?Page=news
which would make index.aspx load news.ascx

And to open the myprofile "Page", the URL would be
http://somehost/index.aspx?Page=myprofile
which would make index.aspx load myprofile.aspx

If you want you can even create several layers
of templates, f.i. index.aspx containing everything
common for all pages, newsitem.ascx containing everything
common for all types of news items, sportnewsitem.a scx
containing everything common for sport news items, etc.
A URL could then look like :
http://somehost/index.aspx?Page=news...tem&Article=26

I believe I learnt this from :
http://www.smartisans.com/articles/vb_templates.aspx

Best regards,

Eric
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2523
by: Andy Todd | last post by:
Hi We have just moved an ASP.NET application into the live environment which is as follows: Sun Proxy Server / Firewall Windows 2000 Server / IIS5 The URL for the site maps to the Sun proxy box. This translates the request and maps it to the Win2K server which responds through the proxy. The Win2K
4
10591
by: bnob | last post by:
In a Button clik event I have this code at the end of the event Response.Redirect("Page.aspx") But in this event I must show a message before redirect to the Page.aspx. I use to show Message this System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=""JavaScript"">" & vbCrLf) System.Web.HttpContext.Current.Response.Write("alert('A message')" &
8
2161
by: Mantorok | last post by:
Hi all When I start a new thread that tries to call: HttpContext.Current.Response.Redirect() It fails as Current returns null, is there anyway to access the current httpcontext from within a new thread? Thanks
3
5495
by: Alan Silver | last post by:
Hello, Sorry if this is a stupid question, but I can't really see much difference between these tow methods according to the scant info in the SDK. Could anyone enlighten me? TIA -- Alan Silver
5
2019
by: Alan Silver | last post by:
Hello, I have a page that is supposed to do some checking, and if OK, set a session variable before redirecting to another page. The following code is a simplified version, I have hard-coded the basket ID and removed a load of extra checking... public partial class GoToCheckout : Page { public void Page_Load(Object o, EventArgs e) { try {
5
4556
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks a session variable, and if it is not present, does a Response.Redirect to a webpage for the CAS passing a url parameter for the url to post back to. The CAS provides a page for the user to log into, validates the username and password, and then...
8
4913
by: Darrel | last post by:
I'm helping convert a 300+ page .html site into an ASP.net site. The client wants to set up 301 redirects for all of the old html pages. I've used ISAPI for this type of thing in the past, as it works great and is easy to set up, but at this point, the client (which is my client, who's working with the actual client) doesn't know what the new web host supports. In the interim, I want to do a bit of research myself on this to see if it's...
7
8055
by: seanmatthewwalsh | last post by:
Hi I have a page (default.aspx) that pulls it's HTML from a database. I then have a "content management" page (editpage.aspx) that allows the user to edit the HTML in the database. When the user clicks the save button on editpage.aspx, the page updates the database and then redirects to the default.aspx page.
3
3518
by: jasonheath.net | last post by:
I apologize in advance for the length of this post. I wanted to get as much detail as possible in here. We have 1 web app that contains the functionality to do some single sign-on logic. The flow is 1. Welcome page 2. Login Page (where the SSO actually occurs) 3. Welcome page 4. Default page
0
8001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7934
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8424
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8286
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5445
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3912
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1537
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1270
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.