473,434 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

Login Control and ReturnUrl

210 Expert 100+
Hello,

I have a database interface that needs to have a login authentication set up. SO for this I have a login view inside which i have the login control and i have accomplished the authentication by using membership class and role. But what i am having issue is with the returnurl. What i am trying to do is if the session expires i want the user to be directed back to the page that the user was on after he logs in. I am sure returnurl is the solution but it doesnt work for me. I am sure i am doing some thing worng. I dont even get any form of query string being passed in. Here is the code that i have in Login.aspx.cs
in the page load event.


Expand|Select|Wrap|Line Numbers
  1.  
  2. protected void Page_Load(object sender, EventArgs e)
  3.     {
  4.  
  5.         string url = Request.QueryString["ReturnUrl"];
  6.         if (!String.IsNullOrEmpty(url))
  7.         {
  8.             Login mylogin = (Login) LoginView1.FindControl("Login1");
  9.            mylogin.DestinationPageUrl = url;
  10.         }
  11.  
  12.     }
  13.  

Do i have to do something else on each pages that will pass the returnurl query string or param.

Please help.

THanks
Feb 14 '08 #1
10 10990
Plater
7,872 Expert 4TB
Does Request.Query ever have anything in it? Try using Request.Parem[] instead?
Feb 14 '08 #2
semomaniz
210 Expert 100+
Why bother having a login section at all if you want them to go right back to the page they were on when the session times out?

There is a header that gets passed when you click a link in the browser called like Referer or something, that would contain the URL of the page they came from.
I editted the explanation while you replied to my problem. Please re-read and help.

Thank you
Feb 14 '08 #3
semomaniz
210 Expert 100+
Can any body help with this issue?
Feb 15 '08 #4
Plater
7,872 Expert 4TB
Can any body help with this issue?
I edited my reply to match your edited question.
Feb 15 '08 #5
semomaniz
210 Expert 100+
I edited my reply to match your edited question.

I did use request.params[] but doesnt work either
Feb 18 '08 #6
semomaniz
210 Expert 100+
I have a form based auntenticated web project. What i am trying to do is if a user's session expires it directs the user to login page after he logs back in I want the user to be redirected to the page that the user was trying to access.

I have used membership class for authentication purpose. on each page at the page_load event i perform a check if the user is authenticated if not it directs the page to login.aspx.

Please refer to the posting
http://www.thescripts.com/forum/thre...returnurl.html

Please help.
Feb 18 '08 #7
Plater
7,872 Expert 4TB
This has some explanation about return url (you will probably need to skip to the ending section)
http://download.microsoft.com/download/3/6/0/3604c3d2-0db9-4726-910d-b3b8f93a86e4/hilo_membership-roles_final.wmv


Also, I merged the threads. While I apologize for not being able to be more helpful, double posting is still against the guidelines.

MODERATOR
Feb 18 '08 #8
semomaniz
210 Expert 100+
sorry didnt really know the guide line of dual posting. But this is where i stand i did get the part of the problem solved but now what i am having issue is that i have multiple queries passing in the returnurl. when i see the path in the IE explorer when the user is sent to login page i can see the multiple querystrings present along with the url of the page. But when i get authenticated only the first querystring is sent to the page and rest of the qureystring that are being sent in are being stripped off. dont know how exactly this is happening. Do you have any idea why this is happening.

I resolved my problem by using only one query string which has multiple information seperated by a comma. Then i using String.Split to seperate the information. This works for me but i am still curious why rest of the query string were dumped after authentication.


Thank you for you help.
Feb 18 '08 #9
Plater
7,872 Expert 4TB
Well what I am wondering is, the authentication schemes that ASP.NET uses, provide the functionality you desire built in (you need to do a smidge of configuration in web.config) but I believe it is part of the login scheme stuff.
That's why I posted that video, I was thinking it detailed (albeit near the end) how to setup the redirection stuff to go back to the page after logging back in.

Those ASP.NET "how do i" series of videos are pretty good.
Feb 18 '08 #10
semomaniz
210 Expert 100+
Thanks,

I will research on this issue later . using delimiter will work for what i want right now but only issue would be documenting it properly what is being passed-in ,in what order and so forth.

Thank you Plater
Feb 18 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Kenneth Keeley | last post by:
Hi, I have a web app that has forms authentication and I can login to the page the first time I go there but it never times me out if I come back in 24 hours a hit the refresh key the page loads...
4
by: David Krussow | last post by:
Just wondering if/how it would be possible to display a variable string on the login form - where the string varies depending on the form the user attempted to access. To clarify, an...
11
by: David W. Simmonds | last post by:
I have a form that will prompt for a user name/password. In VS.NET, I have the protected form in a folder named Admin. I have a Web.config file in that folder as well. It contains the following...
0
by: Steve Commisso | last post by:
I'm trying to create a forked login where users of certain roles will be redirected to specific pages. The easy way to do this would be to do the redirecting in the Page_Load() of the default...
2
by: pv | last post by:
Hi everyone, I need help with following scenario, please: Users are accessing same web server from intranet (users previously authenticated in Active Dir) and from extranet (common public...
2
by: Gary Coutts | last post by:
Hi, I am have problems redirecting from a login page. The login page is simple, with just 2 textboxes and one button. On the button click the routine below is called: I am using: Visual...
1
by: Jakob Lithner | last post by:
When I started a new ASP project I was eager to use the login facilities offered in Framework 2.0/VS 2005. I wanted: - A custom principal that could hold my integer UserID from the database -...
0
by: Jon Paal | last post by:
when using the login control, the user is automatically redirected to the login page with the following: http://127.0.0.1/login.aspx?returnurl=view.aspx?pid=4a126a34&cid=-999 after logging in,...
1
by: Rusty Hill | last post by:
I am using the ASP.NET 2.0 Login control and have provided a valid URL for the PasswordRecoveryURL property. However when the hyperlink is selected the login page continues to be displayed. The...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.