Logging Out & Logging In

Ok this might be a terribly simple one but its really baffeling me...

Quick overview - I am creating a Web Application using Visual Web Developer 2008 (vb) ASP.NET 3.5


Ok, so say if I log in to the application from login.aspx as User1 and then once authenticated I am taken to default.aspx. I then navigate to another page, for arguments sake call it page1.aspx.

Now I log out as User1 and log back in as User2. Instead of being shown default.aspx as earlier I am taken back to the page that the previous user was on - page1.aspx.

How do I set what page is show once a user logs out and back in again?


Many Thanks.

1/6/2009 11:29:47 PM
asp.net.security 27051 articles. 1 followers. Follow

8 Replies

Similar Articles

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

 When you logout, you could simply redirect the user to login.aspx or default.aspx, so the ReturnUrl parameter will be set to either default.aspx or not set at all.

In your forms authentication element in web.config, you can mention the defaultUrl property, which will be used when there is no ReturnUrl query string

Kumar Reddi
1/7/2009 2:51:53 AM

 Hi Kumar,


I have added the following to the web.config file. Is this what you meant?


        <authentication mode="Forms">

             <forms loginUrl="login.aspx" returnUrl="default.aspx">


It appears returnUrl is unrecognized attribute.

Could you advise further?

Many Thanks.

1/7/2009 1:40:46 PM

 returnUrl is generated by the asp.net. The typical returnUrl would be the address of the URL where the user intended to go, prior to login prompt. For example, if user typed

http://localhost/loginTest/default.aspx on a site which requires forms authentication, he would be redirected to login page with the url in the address bar as this


As you can see from the above example, returnUrl was  %%2floginTest%2fdefault.aspx


You can only set, defaultUrl in the web.config. This parameter will be used by the asp.net to redirect the user after authentication, if there is no returnUrl in the query string. Which can happen, if user directly navigates to the login.aspx


Go through this article, for a better understanding of how Forms Authentication work


Kumar Reddi
1/7/2009 2:02:22 PM

Having read about Forms Authentication I'm still having difficulties...

What I am trying to achieve is if a user logs in to the app from login.aspx as User1 and then once authenticated this user is taken to default.aspx. The user then navigates to another page within the app, for example page1.aspx.

Now User1 logs out and a new different users logs in as User2. Instead of being shown default.aspx (as earlier with User1)  User2 is taken back to the page that the previous user was on - page1.aspx.

This is the ReturnUrl that is produced:


 Really i do not want a return ReturnUrl once a user logs out of the app.

So just the link: "http://localhost/loginTest/login.aspx"

or have it as "http://localhost/loginTest/login.aspx?ReturnUrl=%%2floginTest%2fdefault.aspx" as default.


I want the user to go to Default.aspx each time they log in - not be redirected to page the previous user was on... if you see what i mean!


I have set the following to the web.config but it still returns to the page that the previous user was on instead of to default.aspx.

        <authentication mode="Forms">

             <forms loginUrl="login.aspx" DefaultUrl="default.aspx">


Any suggestions??

Many Thanks.

1/13/2009 5:35:13 PM

 That you have to set in the Logout page code

When the user clicks Logout Button, you do FormsAuthentication.Signout.. So in the same code block.. right after you killed the forms authentication and possibly Session also, using Session.Abandon(), simply redirect the user to login.aspx, or default.aspx using Response.Redirect, that way the new user always starts with default.aspx page

Kumar Reddi
1/13/2009 5:39:39 PM

If you are using Asp.net LoginStatus Control ... you can set LogoutAction Property:

<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="RedirectToLoginPage" />

1/13/2009 6:30:41 PM

 That worked brilliantly!!

 Protected Sub LoginStatus_LoggingOut(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs)


 End Sub


 Many thanks for your help Kumar!! Big Smile

1/13/2009 6:32:44 PM



<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="RedirectToLoginPage" />

That works even better!!

Thanks for all your help guys!!


Can either of you shed some light on this...


Has been up since yesterday and had no reponces as yet...

1/13/2009 6:36:27 PM

Similar Artilces:

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 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...

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...

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...

data & log on log device (again)
A co-worker accidently altered a database with ... log2 = 200 ... instead of .. log on log2 = 200 and now we have data on the log device. Since we're in a production environment I'd like to avoid "experiments", neither i'd like to recreate the database and load a dump. A select on sysusages showed that all allocated datapages were still unused, so i executed sp_dropsegment "default", DB, log2 which just dropped the segment reference (segmap changed to 1). Can I safely(!) manipulate the system tables now (or is there any other way)? Thank...

System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
I have tried for 2 hours to get rid of this error when trying to log into my app.  Sometimes when I just refresh our login page I get this also   Security Exception Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: The source was not found, but some or all event logs could not be searched.  Inaccessible log...

ncpserv.log & ncp2nss.log entries
ncpserv.log shows: [! 2010-10-07 07:45:54] EventQueueProcessorThread: IPCServRequest failed rc=1 [! 2010-10-07 07:46:24] IPCServRequest clientErr=1 ncp2nss.log shows: [! 2010-10-12 14:26:57] nssSetDeletorGUID: zZIDOpen failed for file , ccode = 20444 [! 2010-10-12 14:27:27] nssSetDeletorGUID: zZIDOpen failed for file , ccode = 20300 this logs a few times every minute. I can't find anything that tells me what causes these entries, I haven't noticed any problems, and it looks like this has been happening for some time. Any info would be appreciated. OES2, SuSE 10sp...

Logging to httpservlet.log
Anyone have any examples on how to log to this file? I know you need to use the ServletContext interface but I have been unable to find any real examples of how. Thanks for your help. Don Flannagan ...

User Log in Log
I need to keep a daily record of network logins Being Auditcon does not work with NW6, is there a way I can enable Logging on a server/tree to capture user login? Install NSURE Audit. Configure it to record logins and out for both the server and eDir. The Nsure Audit starter pack 1.0.3 is downloadable from the website. ~+~^~+~^~+~^~+~^~+~^~+~^~+~^~ Jim Gosney Netware/Groupwise Admin./Eng. Genesco, Inc. Nashville, TN Currently reading: fiction: Lord of the Rings: Return of the King -- J.R.R. Tolkien non-fiction: George Washington -- James Burns and Susan Dunn rel...

Log files not logging
I have been given responsiblity for running our BorderManager 3.6 system. The server is no longer doing any logging. The last log file is dated August 13 2004. I just took this over. It is BM 3.6. Does anyone have any ideas where to look? Thanks Scott The administration of the log files is located in NWAdmin - select the Bordermanager Setup Tab - highlight HTTP Proxy - click on details - there is a Logging tab there that will tell you where the files are located and for how long, etc. Somtimes I have to go in and clean the logfiles out of the volume - if the volume ...

Application Log logging
Shaun, I have been getting complaints from our techs here about the huge amount of entries Patchlink is writing to the Application log. The problem is when they are trying to troubleshoot a problem on a PC, the application log has filled up with the Zenworks Patch Management Agent entries, pushing out the entries they need for troubleshooting. Aside from increasing the size of the Event logs, is there a way to "throttle" down the entries Patchlink is making? server agent Bob -- bstayskal Bstayskal, what level do you have the agent ...

Transaction Logs And Logging
I work in a shop that does not keep the Sybase transaction logs. We have been mandated to research archiving our logging. The Sybase documentation does not go into great detail about how to do this. Can anyone give me pointers on this, or point me in the way of decent documentation? I understand setting the 'dump transaction' command on the Last Chance thresholds. We have 65 active databases, and the nightmare I have is trying to deal with 65 logs being constantly dumped. Without overwriting each other before they can be copied to tape. Is there an easy way to rename the ...

error log logs
Hi all, In the script I have to stop sybase, I use two instructions for log rotate. su sybase -c 'mv -f $SYBASE/$SYBASE_ASE/install/sybase.log /backup2/logs/sybase-`date +%y%m%d-%H%M%S`.log' su sybase -c 'touch $SYBASE/$SYBASE_ASE/install/sybase.log' But when I start ASE, the server don�t write in this file (sybase.log) it uses to write $SYBASE/errorlog Why????? What can I do to write in $SYBASE/$SYBASE_ASE/install/sybase.log The RUN_file is: #!/bin/sh # # Adaptive Server name: sybase # Master device path: /dev/md/dataset/rdsk/d3 # Error ...

Event Log not Logging ??
 Hi All, On my dev machine when I log errors to the event log all works great however when I move the web application to the test server the events are not being logged... I am hoping it is some configuration issue with IIS however I am totally lost.The code writing the events: EventLog.WriteEntry("xxxxx", err, EventLogEntryType.Error);   Any help will be appreciated. Thanks,Neil  are you getting an error? Sometimes, its a permissions issue, if the log name doesn't exist, it tries to write the new value to the registry. Check the application log...

Logging in without logging in...
Help! I've been asked to integrate a dotnetnuke site with another corporate site to present the user with a seamless transition between the two. The user will login to the corporate site (behind a firewall) and at some point be passed over to the dotnetnuke site (hosted externally). Is there anyway to log the user (who came form the corporate site) into the dotnetnuke site without the user having to retype his / her username / password? I'd prefer not to pass the username / password in the url - something more secure would be preferred. If anyone has any ideas or has done it b...

Web resources about - Logging Out & Logging In - asp.net.security

Logging - Wikipedia, the free encyclopedia
or skeleton cars . In forestry , the term logging is sometimes used in a narrow sense concerning the logistics of moving wood from the stump ...

More Japanese Users Logging On To Facebook
For years, Mixi has been the social media site of choice in Japan. But new reports suggest that Facebook could overtake Mixi by the end of the ...

‘Trusted Contacts’ lets users turn to friends for help logging into Facebook
Facebook today announced “Trusted Contacts,” an update to its “ Trusted Friends ” security feature that sends access codes to a few of a user’s ...

Reps & Sets - Gym Logging on the App Store on iTunes
Get Reps & Sets - Gym Logging on the App Store. See screenshots and ratings, and read customer reviews.

Logging into the iPad...jailbreak style - YouTube
Very early work on porting "Spirit" jailbreak by @comex to iPad ... Questions: http://twitter.com/MuscleNerd

Halting highlands logging could prove lucrative
A report says halting logging in the central highlands could boost the state's coffers.

Conservation areas to be opened up to logging
State forests set aside as conservation areas by the previous Labor government could be declassified and reopened for commercial logging and ...

South Coast residents concerned about bushfire risk from logging slash
... on the NSW south coast have expressed alarm at &quot;metres high&quot; piles of logs, leaves and branches left on forest floors after logging, ...

O'Farrell government rejects call for logging in national parks
The O'Farrell government has rejected calls from an inquiry led by the Shooters and Fishers Party to allow logging in reserved areas

Logging out? Why young people love to hate Facebook
Researchers, journalists writing about research, and young people themselves have been writing about the perceived decline of Facebook for a ...

Resources last updated: 12/31/2015 9:02:48 AM