473,399 Members | 2,278 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,399 software developers and data experts.

Correct way to Redirect for Login

LK
Hi,

I have a UserControl which is embedded onto the header of all my web pages.
When I click Signin, I want the user control to record the page I was on
(the full url if possible), and then redirect to the signin page. When the
user has signed in, I want to redirect back to the originating page. I
cannot seem to get this working, short of frigging the url, and wondered if
there is an easier way?

Thanks

LK.
Nov 19 '05 #1
4 1023
Hello LK,

If you are using forms authentication you can use something like

FormsAuthentication.RedirectToLoginPath();

and .net will handle all the refering URL crap.

Martin.
Hi,

I have a UserControl which is embedded onto the header of all my web
pages. When I click Signin, I want the user control to record the page
I was on (the full url if possible), and then redirect to the signin
page. When the user has signed in, I want to redirect back to the
originating page. I cannot seem to get this working, short of
frigging the url, and wondered if there is an easier way?

Thanks

LK.


Nov 19 '05 #2
Uses formsauthentication which does this for you..
http://www.15seconds.com/issue/020220.htm

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"LK" <fr**@here.com> wrote in message
news:OA**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a UserControl which is embedded onto the header of all my web pages. When I click Signin, I want the user control to record the page I was on
(the full url if possible), and then redirect to the signin page. When the user has signed in, I want to redirect back to the originating page. I
cannot seem to get this working, short of frigging the url, and wondered if there is an easier way?

Thanks

LK.

Nov 19 '05 #3
LK
Karl and Martin,

Thanks for your replies - dont know how I missed the FormsAuthentication
call! Anyway, when I call FormsAuthentication.RedirectFromLoginPage I am
redirected to the Default webpage, and not the page I was actually viewing.
In my test, I was viewing a product detail page I have for sale, and
expected to go back to it if I choose to sign in on this page using the link
in the header. But instead I returned to the home page, which is not what I
am after. Is there anything else I need to do?

Thanks again!

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%2***************@tk2msftngp13.phx.gbl...
Uses formsauthentication which does this for you..
http://www.15seconds.com/issue/020220.htm

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"LK" <fr**@here.com> wrote in message
news:OA**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a UserControl which is embedded onto the header of all my web

pages.
When I click Signin, I want the user control to record the page I was on
(the full url if possible), and then redirect to the signin page. When

the
user has signed in, I want to redirect back to the originating page. I
cannot seem to get this working, short of frigging the url, and wondered

if
there is an easier way?

Thanks

LK.


Nov 19 '05 #4
LK:
Are you simply using RedirectFromLoginPage or are you using
formsauthentication as your authentication mechanism throughout the site?
(ie, specifying FormsAuthentication in the web.config and denying anonymous
users?)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"LK" <fr**@here.com> wrote in message
news:Oi**************@TK2MSFTNGP09.phx.gbl...
Karl and Martin,

Thanks for your replies - dont know how I missed the FormsAuthentication
call! Anyway, when I call FormsAuthentication.RedirectFromLoginPage I am
redirected to the Default webpage, and not the page I was actually viewing. In my test, I was viewing a product detail page I have for sale, and
expected to go back to it if I choose to sign in on this page using the link in the header. But instead I returned to the home page, which is not what I am after. Is there anything else I need to do?

Thanks again!

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:%2***************@tk2msftngp13.phx.gbl...
Uses formsauthentication which does this for you..
http://www.15seconds.com/issue/020220.htm

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"LK" <fr**@here.com> wrote in message
news:OA**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a UserControl which is embedded onto the header of all my web

pages.
When I click Signin, I want the user control to record the page I was on (the full url if possible), and then redirect to the signin page. When

the
user has signed in, I want to redirect back to the originating page. I
cannot seem to get this working, short of frigging the url, and
wondered if
there is an easier way?

Thanks

LK.



Nov 19 '05 #5

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

Similar topics

7
by: Alex Hunsley | last post by:
I'm making a web site that does login authentication. It all works fine, but I have a question about 'correctness'... Certain php scripts on the site should only run in the user has logged on....
5
by: Simon | last post by:
Hi, I have a Login.php page that logs the user in and out. I has two forms within the page, (depending on what we are trying to do), either one to log in or out. The form calls itself using a...
1
by: shank | last post by:
I have a few pages that require login to access. Assuming a user clicks a link containing a variable trying to access a password protected page. That user is redirected to the login page. After...
1
by: Sospeter | last post by:
Hi Ken, I have done that but still experiencing same problem. Tried the following i.e. turning smartnavigation = false and using server.transfer as below but nothing works. Please help. ...
10
by: GreggTB | last post by:
I've got an page (LOGIN.ASPX) that receives the user's login information. During the page load, it checks the credentials against a database and, if validation is successful, creates an instance of...
1
by: Jeremy Chapman | last post by:
I have built a web app. While testing I have found that if I browse to a page in the app, then get redirected to the login page and enter my credentials. The...
3
by: William Sullivan | last post by:
Have a frameset HTML page (parent) with child .aspx pages. When each of the child pages loads, it checks to see if the user is authenticated, and if not, redirects to the login page: ...
7
by: savvy | last post by:
I able to redirect the user to the index.aspx page after every successful login, but I dont want certain pages outside the folder to have a access to general public. So if they click that...
1
by: Culley | last post by:
I've created a secure login site. Everything works fine except for one thing... the redirect. I want to redirect users to the correct page they are accessing (say they're just clicking a link...
0
by: sandari | last post by:
The following code (web.config in Visual Studio 2005) is supposed to redirect a user to the appropriate Form depending on their role. However, regardless of the user's role, the only page...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
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...

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.