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

How to know when to RedirectFromLoginPage?

Suppose the first URL a visitor visits is Logon.aspx. There's not an original page to
return the user to. So how can I detect whether to send the user to the original page
he tried to visit versus send him to a default page?

I'm looking at this in the MS doc:

http://msdn.microsoft.com/library/de...ClassTopic.asp

void LoginBtn_Click(Object sender, EventArgs e)
{
if (Page.IsValid)
{
// Call the authentication event handler delegate (not included in
this example).
if (FormsAuthentication.Authenticate(UserName.Text, UserPass.Text))
{
// Return to the originally requested URL.
FormsAuthentication.RedirectFromLoginPage(UserName .Text,
Remember.Checked);
}
else
{
Msg.Text = "Invalid Credentials: Please try again";
}
}
}

Well, I want to send the user to somem page that is my default if he didn't try to
visit some page already.
Dec 4 '05 #1
6 1297
I always enforce the default.aspx i want.
No-one has any business in the login page after login.
If you want an automated system, you could deny logged-in users?
(web.config, never tried that though)
"Randall Parker" <NOtechieSPAMpundit_please@future_avoidjunk_pundit .com>
schreef in bericht news:er***************@tk2msftngp13.phx.gbl...
Suppose the first URL a visitor visits is Logon.aspx. There's not an
original page to return the user to. So how can I detect whether to send
the user to the original page he tried to visit versus send him to a
default page?

I'm looking at this in the MS doc:

http://msdn.microsoft.com/library/de...ClassTopic.asp

void LoginBtn_Click(Object sender, EventArgs e)
{
if (Page.IsValid)
{
// Call the authentication event handler delegate (not
included in this example).
if (FormsAuthentication.Authenticate(UserName.Text,
UserPass.Text))
{
// Return to the originally requested URL.
FormsAuthentication.RedirectFromLoginPage(UserName .Text,
Remember.Checked);
}
else
{
Msg.Text = "Invalid Credentials: Please try again";
}
}
}

Well, I want to send the user to somem page that is my default if he
didn't try to visit some page already.

Dec 4 '05 #2
Edwin,

Once a user has seen:
http://www.somesiteurlhere.com/Logon.aspx
the user could bookmark that URL.

So users could certainly enter the site on the Logon.aspx page. Or the user could
enter on a different page and then get redirected to Logon.aspx. I want to detect the
difference between those two cases.

So when that user hits that URL how do I detect he came in to that URL without trying
to access another page on the same site?

I want to detect that the first page visited was Logon.aspx and then redirect to a
particular page. How to detect that?

Edwin Knoppert wrote:
I always enforce the default.aspx i want.
No-one has any business in the login page after login.
If you want an automated system, you could deny logged-in users?
(web.config, never tried that though)
"Randall Parker" <NOtechieSPAMpundit_please@future_avoidjunk_pundit .com>
schreef in bericht news:er***************@tk2msftngp13.phx.gbl...
Suppose the first URL a visitor visits is Logon.aspx. There's not an
original page to return the user to. So how can I detect whether to send
the user to the original page he tried to visit versus send him to a
default page?

Dec 4 '05 #3
1) I have 2 apps running where i logoff the user when they access this
logon.aspx
Just my decision, maybe not yours, it will learn them not to bookmark this
page :)

2) If they access this page, and they are already authenticated, redirect in
page_load ?
Maybe i have overlooked a part of your problem here.
There is a 'user object' somewhere in FormsAuthentication to determine:
..isauthenticated()


"Randall Parker" <NOtechieSPAMpundit_please@future_avoidjunk_pundit .com>
schreef in bericht news:eR****************@TK2MSFTNGP11.phx.gbl...
Edwin,

Once a user has seen:
http://www.somesiteurlhere.com/Logon.aspx
the user could bookmark that URL.

So users could certainly enter the site on the Logon.aspx page. Or the
user could enter on a different page and then get redirected to
Logon.aspx. I want to detect the difference between those two cases.

So when that user hits that URL how do I detect he came in to that URL
without trying to access another page on the same site?

I want to detect that the first page visited was Logon.aspx and then
redirect to a particular page. How to detect that?

Edwin Knoppert wrote:
I always enforce the default.aspx i want.
No-one has any business in the login page after login.
If you want an automated system, you could deny logged-in users?
(web.config, never tried that though)
"Randall Parker" <NOtechieSPAMpundit_please@future_avoidjunk_pundit .com>
schreef in bericht news:er***************@tk2msftngp13.phx.gbl...
Suppose the first URL a visitor visits is Logon.aspx. There's not an
original page to return the user to. So how can I detect whether to send
the user to the original page he tried to visit versus send him to a
default page?

Dec 4 '05 #4
Edwin,

Yes, you missed my problem: In both cases (visit Logon.aspx first or visit some other
page first) I am thinking about the case where the user has NOT logged on first.

The two cases where he is not already logged on.

1) The user visits Logon.aspx first. The user logs in. Okay, I want to redirect the
user. But I should NOT redirect him back to Logon.aspx. I need to detect that the
user came to Logon.aspx first and then redirect the user to my default starter page.

2) The user visits some other page first and gets redirected to Logon.aspx because
he's not already logged on. Okay, he logs on. Then I redirect to where he first tried
to visit.
Edwin Knoppert wrote:
1) I have 2 apps running where i logoff the user when they access this
logon.aspx
Just my decision, maybe not yours, it will learn them not to bookmark this
page :)

2) If they access this page, and they are already authenticated, redirect in
page_load ?
Maybe i have overlooked a part of your problem here.
There is a 'user object' somewhere in FormsAuthentication to determine:
.isauthenticated()

Dec 4 '05 #5
Well #2 should address that :)

However, in the 2nd item you gave, returnurl is set.
So use querystring("returnurl") and use that.

"Randall Parker" <NOtechieSPAMpundit_please@future_avoidjunk_pundit .com>
schreef in bericht news:O%******************@TK2MSFTNGP14.phx.gbl...
Edwin,

Yes, you missed my problem: In both cases (visit Logon.aspx first or visit
some other page first) I am thinking about the case where the user has NOT
logged on first.

The two cases where he is not already logged on.

1) The user visits Logon.aspx first. The user logs in. Okay, I want to
redirect the user. But I should NOT redirect him back to Logon.aspx. I
need to detect that the user came to Logon.aspx first and then redirect
the user to my default starter page.

2) The user visits some other page first and gets redirected to Logon.aspx
because he's not already logged on. Okay, he logs on. Then I redirect to
where he first tried to visit.
Edwin Knoppert wrote:
1) I have 2 apps running where i logoff the user when they access this
logon.aspx
Just my decision, maybe not yours, it will learn them not to bookmark
this page :)

2) If they access this page, and they are already authenticated, redirect
in page_load ?
Maybe i have overlooked a part of your problem here.
There is a 'user object' somewhere in FormsAuthentication to determine:
.isauthenticated()

Dec 5 '05 #6
Hmm, it seems you found a solution already:

Topic "How to keep RETURNURL in the URL if incorrect password?"

?
"Randall Parker" <NOtechieSPAMpundit_please@future_avoidjunk_pundit .com>
schreef in bericht news:O%******************@TK2MSFTNGP14.phx.gbl...
Edwin,

Yes, you missed my problem: In both cases (visit Logon.aspx first or visit
some other page first) I am thinking about the case where the user has NOT
logged on first.

The two cases where he is not already logged on.

1) The user visits Logon.aspx first. The user logs in. Okay, I want to
redirect the user. But I should NOT redirect him back to Logon.aspx. I
need to detect that the user came to Logon.aspx first and then redirect
the user to my default starter page.

2) The user visits some other page first and gets redirected to Logon.aspx
because he's not already logged on. Okay, he logs on. Then I redirect to
where he first tried to visit.
Edwin Knoppert wrote:
1) I have 2 apps running where i logoff the user when they access this
logon.aspx
Just my decision, maybe not yours, it will learn them not to bookmark
this page :)

2) If they access this page, and they are already authenticated, redirect
in page_load ?
Maybe i have overlooked a part of your problem here.
There is a 'user object' somewhere in FormsAuthentication to determine:
.isauthenticated()

Dec 5 '05 #7

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

Similar topics

0
by: Rob O'Cop | last post by:
Hi, I've got an Intranet site that's been using the usual Forms authentication. Now, I want to retrieve the Windows Login and authenticate the user automatically without her typing...
2
by: Gan | last post by:
Hi, I just wonder after calling the RedirectFromLoginPage function, my current page still stick to login.aspx fiile. Any clue?? Thanks
0
by: CW | last post by:
I am really confused as to how secure FormsAuthentication really is, and I'd appreciate if someone could shed light on it. I find information at MSDN incomplete at best and self-contradictory other...
2
by: Rob O'Cop | last post by:
Hi, I've got an Intranet site that's been using the usual Forms authentication. Now, I want to retrieve the Windows Login and authenticate the user automatically without her typing...
2
by: tshad | last post by:
I have a logon page that is may be called by the Forms Authentication setup. This would put a ReturnURL as part of the URL. I would normally then just issue a: ...
1
by: Sehboo | last post by:
Hi, I have form authentication, and am using RedirectFromLoginPage to redirect to the page which is set by 'Set as start page'. My question is, can I decide at run-time where I want to redirect...
3
by: Ben Fidge | last post by:
Hi I have an app that requires the following scenarios: - A registererd user can login via a login page. This will redirect them to Default.aspx via the use of...
2
by: genc ymeri | last post by:
hi, I'm doping a maintenance for a project but I'm having an interesting issue with RedirectFromLoginPage coomand :) What happens is that the webapp, once user logs in, he/she goes gets...
0
by: Imran Aziz | last post by:
Hello All, I cannot seem to get createPersistentCookie option of FormsAuthentication.RedirectFromLoginPage work. Even if I set it to true the cookie is setup to expire after 30 min ( default...
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?
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
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
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
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
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...

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.