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_Click 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()
FormsAuthentication.SignOut()
and this doesnt seem to work, does anyone have any ideas how I can
acomplish a logout via code?
Regards
MickMick 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_Click 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()
> FormsAuthentication.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="CustomizedProvider">
<providers>
<add name="CustomizedProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="SDConn" minRequiredPasswordLength="5"
minRequiredNonalphanumericCharacters="0"/>
</providers>
</membership>
<roleManager enabled="true" defaultProvider="CustomizedRoleProvider">
<providers>
<add connectionStringName="SDConn" name="CustomizedRoleProvider"
type="System.Web.Security.SqlRoleProvider"/>
</providers>
</roleManager>
<authentication mode="Forms"/>
Friday, March 16, 2012
Membership - Log Out Programatically
Labels:
app,
asp,
control,
handler,
log,
login,
loginbutton_click,
membership,
net,
programatically,
situation,
tomy,
user,
web
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment