why after I log out my website and log in again. the last page that I logged out on thats the page I am redirected to...

why after I log out my website and log in again. the last page that logged out on thats the page I am redirected to...when logged in again. I thougt when you login though thr login control it goes to the assigned destination page. well, my website is not doing that. whatever page the user has last visited and the user decides to login again thats the page the user will be redirected to after they login. I am using the person website starter template. any ideas why this happens and/or how to fix it?

0
cluce
7/23/2008 6:53:27 PM
asp.net.security 27051 articles. 1 followers. Follow

10 Replies
1165 Views

Similar Articles

[PageSpeed] 41
Get it on Google Play
Get it on Apple App Store

This is the default behaviour of login control , it redirect back the user to the page that he /she was viewing it , this behaviour exists to redirect the user back to the page that he /she was working on,

if you want to overried this behaviour , you can handle the loggedin event for yur login control and use response.redirect to always send the user to a specific page .

 


Regards,

Anas Ghanem.


Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums (like duplicate ,Off-topic,offensive,or any post that violates the website "TERMS OF USE"). -- Thanks!

0
anas
7/23/2008 7:15:34 PM

where exactly is this event"loggedin event "?

0
cluce
7/23/2008 7:24:21 PM

Through the control properties , go to events and click on the LoggedIn event , this will automaticly creates a function in the code behind , add the reponse.redirect  code there


Regards,

Anas Ghanem.


Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums (like duplicate ,Off-topic,offensive,or any post that violates the website "TERMS OF USE"). -- Thanks!

0
anas
7/23/2008 7:31:20 PM

really? this is the properties through teh login control? If so, I dont see an event setting?? I looked in the beahvior section and else where. I have no luck. do you have an example of the tag element where this may be located at? thanks

0
cluce
7/23/2008 7:46:46 PM

IN VB :

    Protected Sub Login1_LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs) Handles Login1.LoggedIn
        Response.Redirect("SmePage.aspx")
    End Sub
 
Regards,

Anas Ghanem.


Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums (like duplicate ,Off-topic,offensive,or any post that violates the website "TERMS OF USE"). -- Thanks!

0
anas
7/24/2008 1:22:18 PM

Hi

try this:

protected void Login1_LoggedIn(object sender, EventArgs e)

{

TextBox TextBox1 = (TextBox)Login1.FindControl("UserName");

//MembershipUser user = Membership.GetUser(TextBox1.Text);

MembershipUser user = Membership.GetUser(Login1.UserName);if (Request.QueryString["ReturnUrl"] != null)

{

Response.Redirect(Request.QueryString[
"ReturnUrl"].ToString());

}

else

{

//-- check if login user in Admin role

if (Roles.IsUserInRole(TextBox1.Text, "Admin"))

{

Response.Redirect(
"~/Admin/Default.aspx");

}

//-- check if login user in User role

else if (Roles.IsUserInRole(TextBox1.Text, "User"))

{

Response.Redirect(
"~/User/Default.aspx");

}

}

 

}

Good Luck

0
yasserzaid
7/25/2008 1:15:06 PM

and if you want to handle Error of Login User

try this:

protected void Login1_LoginError(object sender, EventArgs e)
    {
        //There was a problem logging in the user

        //See if this user exists in the database
        MembershipUser userInfo = Membership.GetUser(Login1.UserName);

        if (userInfo == null)
        {
            //The user entered an invalid username...

            Login1.FailureText = "There is no user in the database with the username " + Login1.UserName;
        }
        else
        {
            //See if the user is locked out or not approved
            if (!userInfo.IsApproved)
            {

                Login1.FailureText = "Your account has not yet been approved by the site's administrators. Please try again later...";
            }
            else if (userInfo.IsLockedOut)
            {
                Login1.FailureText = "Your account has been locked out because of a maximum number of incorrect login attempts. You will NOT be able to login until you contact a site administrator and have your account unlocked.";
            }
            else
            {
                //The password was incorrect (don't show anything, the Login control already describes the problem)
                Login1.FailureText = string.Empty;
            }
        }

}

Good Luck

0
yasserzaid
7/25/2008 1:23:20 PM

I used your login1_LoggedIn event and I am getting this error..

Error 1 Handles clause requires a WithEvents variable defined in the containing type or one of its base types. 

0
cluce
7/26/2008 12:51:34 AM

It seems that you placed the login control inside a nother cotrol like loginview ....

Please remove Handles clause from the event handler like this

    Protected Sub Login1_LoggedIn(ByVal sender As Object, ByVal e As System.EventArgs) Handles Login1.LoggedIn
        Response.Redirect("SmePage.aspx")
    End Sub

And In the login control , assign the handler declarativle like this :

<asp:Login ID="Login1" runat="server" OnLoggedIn="Login1_LoggedIn">

</asp:Login>


Regards,

Anas Ghanem.


Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums (like duplicate ,Off-topic,offensive,or any post that violates the website "TERMS OF USE"). -- Thanks!

0
anas
7/26/2008 12:37:01 PM

thanks. I had a feeling it was something like that. just wasnt sure how to fix it. I am still learning how to do these custom Protected Sub procedures.  it works now.

0
cluce
7/28/2008 2:01:38 AM
Reply:

Similar Artilces:

User logged in (and logged in on all pages)
Hello, If i get a user to log in, after entering there username and password, when they go to other pages, how do i keep them logged in??? like this asp.net site, it says at the top, logged in as:Breenan, and cant see my username in the url address bar.... Any help???? Thanks again. There are many ways to store state information besides in a querystring (which shows up in the address bar)... One common one is a Session variable which acts like a global variable for the entire application. The name could also be gotten from the database, every time the page loads, or it coul...

Logging log
Hi! I try to accomplish task described in http://forums.novell.com/novell-product-support-forums/zenworks/configuration-management/zcm-server-install/422609-mixed-login.html?pagenumber= and wonder I don't know how to keep log of logging? I mean, does ZCM is capable to keep logging log? As Altiris NS does? More thanks, Alar. -- NovAlf ------------------------------------------------------------------------ You look like you want to log in to your zone as a user from either a eDIR or AD. And yes this is possible, it will search both Directories. http://www.theurbanp...

Logged In As: Not Logged In
I installed ZCF 10.0.1 on a Win 2K3 server and when I install the ZEN client on a workstation the ZENWORKS client login comes up and I cannot log into it. It shows me the realm name of my tree and Zenworks Zone and I have tried both to no avail. When I look at the details of the adaptive agent it says, "Logged In As: Not Logged In" Any ideas? On Fri, 11 Jan 2008 14:55:21 GMT, Jayson E. Hahn wrote: > Any ideas? Debug logs in ZCM http://www.novell.com/support/search.do?cmd=displayKC&docType=kc&externalId=3418069&sliceId=SAL_Public&dialogID=51010132...

To log or not to log
Hello foremen, on a large database, trillions of SELECTs and DELETEs are going to be performed. After that, the database is going to be unloaded. The database uses a transaction log. Should I keep the log there along this process or "unmount" it after some parts of it (or even before the beginning)? In this case, nothing but the speed is important. The database is ASA 7.0.4.3498. Thanks Pavel LOG... ALWAYS LOG. Performance is dependent on the use of the log. Recommendations: 1) Ensure that the file system is not excessively fragmented 2) Host the db f...

when i log in, I get the logged in view(which I have left it blank) not the appropriate logged in page ( the roles does not seem to work..)
Hello everyone, My website is online now. I can access my database online in one of the other page..but When I log in at the log in page, I see only the logged in view. I dont see the appropriate role's page. For example. John is from an admin roles group. When I log in using john's username and pword, I get a blank page (which I know for sure is the loggedin view page which I have left it blank). I have three roles and not of them seem to work,.,,It however works fine when I run it on my home computer locally (I change the webconfig file when i run my log in page .) &nb...

Logging in to form based log in page
------=_NextPart_000_004F_01C2272F.3F915330 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello all. I'm trying to write a script that logs in to a web page that = has the user name and password input boxes as part of the initial web = page. I've tried doing a "POST" with the user name and password = declarations and values in the request to no avail. Here is my code: my $myUserAgent =3D LWP::UserAgent->new; $myUserAgent->agent("Automation/0.1"); my $myRequest =3D HTTP::Request->new(PO...

not logged in redirects to login page and allows no other page
I have been experimenting with redirecting a user that tries to go straight to a page without logging in first.  When the user does this, he/she is redirected to the login page.  Once on the login page there is a link to the register page.  However, because the user is not "logged" in when they click the register page it redirects them back to the login page.  I know I have this determined in the web.config file so I am wondering; is there a way to allow this page but maintain the redirect for all others? I need to allow access to both the login and register ...

RE: Logging in to form based log in page
> -----Original Message----- > From: Kenny G. Dubuisson, Jr. [mailto:kdubuisson@kcmria.com] > Sent: Tuesday, July 09, 2002 7:59 AM > To: libwww@perl.org > Subject: Logging in to form based log in page > > > Hello all. I'm trying to write a script that logs in to a > web page that has the user name and password input boxes as > part of the initial web page. I've tried doing a "POST" with > the user name and password declarations and values in the > request to no avail. Here is my code: [snipped] Hi Kenny; Try...

Fw: Logging in to form based log in page
Thanks for the response. I tried that to no avail. Here is what the "new" code looks like: my $myUserAgent = LWP::UserAgent->new; $myUserAgent->agent("Automation/0.1"); my $myRequest = HTTP::Request->new(POST => $configSettings{"url"}); $myRequest->content_type('application/x-www-form-urlencoded'); $myRequest->content("URI=/documents/database.htm&From=wsjauth&Login=xyz&Pass word=123"); my $myResponse = $myUserAgent->request($myRequest); Thanks, Kenny ----- Original Message ----- From: "WOR...

Logging in from a page other then home page
I am a little confused on something.I have a home page, with a login control.I have another page, that has the same login control, but i cannot login from that second page.Anyone have any ideas why not?  If you need some more information from me, please ask.Thanks Your infomation is too little. Please provide more. when you said "cannot login", what happen?...

RE: Logging in to form based log in page #3
[snipped] > > Ron: > > Does it have to select the second one...i.e. would the first > (default) one > work? Thanks, > Kenny I believe it is selecting the first one, and it will just hang. Here is the output from the debug LWP::UserAgent::new: () LWP::UserAgent::request: () HTTP::Cookies::add_cookie_header: Checking online.wsj.com for cookies HTTP::Cookies::add_cookie_header: Checking .wsj.com for cookies HTTP::Cookies::add_cookie_header: Checking wsj.com for cookies HTTP::Cookies::add_cookie_header: Checking .com for cookies LWP::UserAgent::send_req...

RE: Logging in to form based log in page #2
[snipped] > > Ron: > > You code worked well. I just have one question...how do I > get the final > page that I was supposed to be redirected to once I logged > in. Below is the > code I tried with the goal of having the final web page text > in the temp > HTML file; what I get now seems to be the cookie data. I tried > "$response->content" also but it was empty. [more snippage] > > use strict; > > use HTTP::Request::Common; > > use HTML::Form; > > use LWP::UserAgent; > > use LWP::Debug...

Fw: Logging in to form based log in page #2
Ron: You code worked well. I just have one question...how do I get the final page that I was supposed to be redirected to once I logged in. Below is the code I tried with the goal of having the final web page text in the temp HTML file; what I get now seems to be the cookie data. I tried "$response->content" also but it was empty. use strict; use HTTP::Request::Common; use HTML::Form; use LWP::UserAgent; #use LWP::Debug qw(+); use HTTP::Cookies; use FileHandle; my $ua = LWP::UserAgent->new(); $ua->agent("Automation/0.1"); $ua->cookie_ja...

Fw: Logging in to form based log in page #3
Ron: Does it have to select the second one...i.e. would the first (default) one work? Thanks, Kenny > by default HTTP::Form will select the first submit button but the form > contains 2 of them > and I have no idea how to tell HTTP::Form to click the second one ( since > they both have no name). > If anyone has a way to do this I would like to know :-) > > I hope this helps > > Ron Hill ...

Web resources about - why after I log out my website and log in again. the last page that I logged out on thats the page I am redirected to... - asp.net.security

Category:Wikipedia soft redirected project pages - Wikipedia, the free encyclopedia
Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. , a non-profit organization.

Agile Artisans: You'll be redirected in just a moment...
Agile Artisans: You'll be redirected in just a moment...

Logged-Out Users Cannot See Facebook Pages’ Content; Redirected To News Feed After Login
Web surfers who are not logged in to Facebook and try to access pages on the social network are landing on the news feed once they input their ...

Flickr: The Help Forum: [locked, redirected] flickr now censoring all moderate and restricted photos ...
Flickr is almost certainly the best online photo management and sharing application in the world. Show off your favorite photos and videos to ...

Prank of the Day: Someone Bought Anti-Gay Group’s Expired Domain Name, Redirected It to Gay Porn
Anti-gay protesters were picketing outside the Carolina Rebellion rock festival at the Charlotte Motor Speedway earlier this month, so one of ...

Smartphones redirected to Candy Crush, porn sites automatically - Technology - Tech News and Latest New ...
IT IS truly a 21st century problem, but one with potentially very serious implications. It may have even happened to you.

Smartphones redirected to Candy Crush, porn sites automatically
IT IS truly a 21st century problem, but one with potentially very serious implications. It may have even happened to you.

Large chunk of Chinese internet traffic redirected to small Wyoming building
In one of the more bizarre twists in recent Internet memory, much of the Internet traffic in China was redirected to a mysterious company in ...

Attack on Dailymotion redirected visitors to exploits
Attackers injected malicious code into Dailymotion.com, a popular video sharing website, and redirected visitors to Web-based exploits that installed ...

$200m redirected from wages to childcare training
THE Abbott government will redirect about $200 million that was meant to go to lifting childcare wages to helping long day care services with ...

Resources last updated: 12/16/2015 4:00:43 AM