473,785 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Membership - Log Out Programatically

Hi All,

I have a situation where I am using a login control to log a user in to
my web app.
Under the LoginButton_Cli ck handler of the login control, I retrive some
custom user information from the database.
Based on this information, the situation may arise where I want to log
the user out automatically even if a valid username/password has been
entered in the login control.

I have tried using:
Session.Abandon ()
FormsAuthentica tion.SignOut()
and this doesnt seem to work, does anyone have any ideas how I can
acomplish a logout via code?

Regards
Mick
Jul 17 '07 #1
4 5109
Mick Walker wrote:
Hi All,

I have a situation where I am using a login control to log a user in to
my web app.
Under the LoginButton_Cli ck handler of the login control, I retrive some
custom user information from the database.
Based on this information, the situation may arise where I want to log
the user out automatically even if a valid username/password has been
entered in the login control.

I have tried using:
Session.Abandon ()
FormsAuthentica tion.SignOut()
and this doesnt seem to work, does anyone have any ideas how I can
acomplish a logout via code?

Regards
Mick
Oh I forgot to mention I am using Forms Authentication, here is the
relevent info from my web.config
<membership defaultProvider ="CustomizedPro vider">
<providers>
<add name="Customize dProvider"
type="System.We b.Security.SqlM embershipProvid er"
connectionStrin gName="SDConn" minRequiredPass wordLength="5"
minRequiredNona lphanumericChar acters="0"/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider ="CustomizedRol eProvider">
<providers>
<add connectionStrin gName="SDConn" name="Customize dRoleProvider"
type="System.We b.Security.SqlR oleProvider"/>
</providers>
</roleManager>
<authenticati on mode="Forms"/>
Jul 17 '07 #2
On Jul 17, 3:44 pm, Mick Walker <Mick.Wal...@pr ivacy.netwrote:
Mick Walker wrote:
Hi All,
I have a situation where I am using a login control to log a user in to
my web app.
Under the LoginButton_Cli ck handler of the login control, I retrive some
custom user information from the database.
Based on this information, the situation may arise where I want to log
the user out automatically even if a valid username/password has been
entered in the login control.
I have tried using:
Session.Abandon ()
FormsAuthentica tion.SignOut()
and this doesnt seem to work, does anyone have any ideas how I can
acomplish a logout via code?
Regards
Mick

Oh I forgot to mention I am using Forms Authentication, here is the
relevent info from my web.config
<membership defaultProvider ="CustomizedPro vider">
<providers>
<add name="Customize dProvider"
type="System.We b.Security.SqlM embershipProvid er"
connectionStrin gName="SDConn" minRequiredPass wordLength="5"
minRequiredNona lphanumericChar acters="0"/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider ="CustomizedRol eProvider">
<providers>
<add connectionStrin gName="SDConn" name="Customize dRoleProvider"
type="System.We b.Security.SqlR oleProvider"/>
</providers>
</roleManager>
<authenticati on mode="Forms"/>- Hide quoted text -

- Show quoted text -
Maybe change the role of a user could help you here?

Jul 18 '07 #3
Alexey Smirnov wrote:
On Jul 17, 3:44 pm, Mick Walker <Mick.Wal...@pr ivacy.netwrote:
>Mick Walker wrote:
>>Hi All,
I have a situation where I am using a login control to log a user in to
my web app.
Under the LoginButton_Cli ck handler of the login control, I retrive some
custom user information from the database.
Based on this information, the situation may arise where I want to log
the user out automatically even if a valid username/password has been
entered in the login control.
I have tried using:
Session.Aband on()
FormsAuthenti cation.SignOut( )
and this doesnt seem to work, does anyone have any ideas how I can
acomplish a logout via code?
Regards
Mick
Oh I forgot to mention I am using Forms Authentication, here is the
relevent info from my web.config
<membership defaultProvider ="CustomizedPro vider">
<providers>
<add name="Customize dProvider"
type="System.W eb.Security.Sql MembershipProvi der"
connectionStri ngName="SDConn" minRequiredPass wordLength="5"
minRequiredNon alphanumericCha racters="0"/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider ="CustomizedRol eProvider">
<providers>
<add connectionStrin gName="SDConn" name="Customize dRoleProvider"
type="System.W eb.Security.Sql RoleProvider"/>
</providers>
</roleManager>
<authenticati on mode="Forms"/>- Hide quoted text -

- Show quoted text -

Maybe change the role of a user could help you here?
I can't see how this would help me to be honest. At present I only have
two roles. User and Moderator.

Could you elaborate please?
Jul 19 '07 #4
On Jul 19, 3:05 am, Mick Walker <Mick.Wal...@pr ivacy.netwrote:
Alexey Smirnov wrote:
On Jul 17, 3:44 pm, Mick Walker <Mick.Wal...@pr ivacy.netwrote:
Mick Walker wrote:
Hi All,
I have a situation where I am using a login control to log a user in to
my web app.
Under the LoginButton_Cli ck handler of the login control, I retrive some
custom user information from the database.
Based on this information, the situation may arise where I want to log
the user out automatically even if a valid username/password has been
entered in the login control.
I have tried using:
Session.Abando n()
FormsAuthentic ation.SignOut()
and this doesnt seem to work, does anyone have any ideas how I can
acomplish a logout via code?
Regards
Mick
Oh I forgot to mention I am using Forms Authentication, here is the
relevent info from my web.config
<membership defaultProvider ="CustomizedPro vider">
<providers>
<add name="Customize dProvider"
type="System.We b.Security.SqlM embershipProvid er"
connectionStrin gName="SDConn" minRequiredPass wordLength="5"
minRequiredNona lphanumericChar acters="0"/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider ="CustomizedRol eProvider">
<providers>
<add connectionStrin gName="SDConn" name="Customize dRoleProvider"
type="System.We b.Security.SqlR oleProvider"/>
</providers>
</roleManager>
<authenticati on mode="Forms"/>- Hide quoted text -
- Show quoted text -
Maybe change the role of a user could help you here?

I can't see how this would help me to be honest. At present I only have
two roles. User and Moderator.

Could you elaborate please?
you could create a 3rd role like 'lockedout' and deny this role the
rights to view content

Jul 19 '07 #5

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

Similar topics

1
4073
by: Karen Hill | last post by:
I would like to be able to programatically check for group membership in an access database. For example, I would like to be able to check is someone is in the admin group before the program does Y. something like: if( current.user.group == admin){ do_something(); }
9
2175
by: Paul Keegstra | last post by:
Hi, I am currently working on an asp.net 2.0 web site that is a replacement of a classic asp web site. The current web site uses a Commerce Server 2002 database for storing user information. It does not currently use any of the Commerce Server 2002 functionality with the exception of the user authentication features. I have written my replacement application to use a custom login form and custom connection string so that I can use...
3
1924
by: ibiza | last post by:
Hi all, I am currently developing in asp.net 2.0 and I was at first impressed with the numerous login and user controls they provided to ease the task of managing users. But I am starting to think it's an hassle for certain tasks...here's my problem : I have created some users and successfully log them with the supplied
2
14157
by: Balaji | last post by:
Hi All, Can I use more than one membership provider for a given website? I understand only one of them could be default one. If yes, then how to programmatically access the other membership provider? For e.g. lets say I have a SQLMembership provider and OracleMembership provider. SQL would be my default provider. During authentication, based on the value of an additional parameter in the login screen, I need to validate against SQL or...
3
3282
by: ryan.mclean | last post by:
Hello everyone, I am wondering, can the membership provider be changed at runtime? Perhaps the connectionStringName? I would like to use a different database based on the server the site is on. I suppose that a custom provider could be used to accomplish this, is there another way?
4
4733
by: =?Utf-8?B?Q2hyaXMgQ2Fw?= | last post by:
I have been having some trouble with implementing a custom Membership Provider. We have a custom data store and business logic that pulls user information. I need some level of functionality above and beyond what the prodiver currently allows. I need the ability to access a user id and the user's permission id. With Forms authentication in 1.1, I would just create a custom identiy and principal and store the information in the identity....
3
2184
by: Glenn | last post by:
My current classic-ASP site has users, projects, roles and the 2.0 membership looks like a perfect fit, but I'm having trouble finding examples of how to have users that belong to different projects, and have different roles per project. The current model.. * When a user joins my site, they eventually end up joining or creating one or more projects. But, they are not required to be a member of a project to be a member of the site.
1
2379
by: =?Utf-8?B?ZVByaW50?= | last post by:
Asp.Net v2.0 I have created a web application and I am using it from a single website and database. The web application has different ‘portals’ – each independent and I am using the Membership & Roles ApplicationName to separate out my different groups of users within the membership database. I had been having problems with ‘random’ bugs - as though my Membership database was 'sharing' information between users and...
2
2677
by: NitinSawant | last post by:
Hello, How to Programatically Update Membership Role i.e. Rename a role using C#? In "Roles" class there are methods to add,read, delete roles but there is no method to Update the role... I know this is possible using web administration tool but i want the novice user to do it on client machine using the interface which i provide.. regards, Nitin Sawant
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10324
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9949
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.