.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Membership: Logout a User

Posted By:      Posted Date: October 23, 2010    Points: 0   Category :ASP.Net

I have an Admin page that allows the admin to edit user details and change their account. I would also like the admin to be able to logout a different user. I've tried numerous ways to do this with no avail. Any ideas? 

View Complete Post

More Related Resource Links

Logout a User from ASP Membership with Java Script


Case is if a user wants to clear their personal information from a page after clicking on a button that they be re-directed to the ASP Login page. This code needs to be developed using Java Script because I want the user to confirm with a confirmation box that they intended to clear their info. I have found resources on MS that pointed to referencing the "System Web Extension" within the Web Config file shown below, which enables Java Script to be able to reference the Authentication Service classes. I am also calling the function show_confirm in the button onclick event to process the message box response.

I also need to redirect a user back to the Login page within this same show_confirm() function without pointing directly to the URL, but instead to the folder where the page is locateded like in VB Server Redirect if possible.

The error message I receive when I run this code is: Microsoft JScript runtime error: 'sys' is undefined.

Any help will be grate full!



        <authenticationService enabled="true" />


function show_confirm(message) {
    var r = confirm

Membership Search user


Is there a membership function to search a username Like this:   LIKE '%UserName%' ?

This is not working.

MembershipUser User = Membership.GetUser("%" + TextBox1.Text + "%");

Thank you.

Use ASP.NET Membership store for user settings with Windwos Authentication

I am evaluating ASP.NET Membership for an intranet Silverlight app. I want users to be automatically authenticated for my application with their windows logon.Thus I configured Windows Authentication.I would like to store user settings like email-address in using the SqlMembershipProvider and not AD. It seems that storing user settings using the SqlMembershipProvider is not supported with Windows Authentication. Is this really so (using .NET 4)? If so: What is the rationale behind this?IMHO authentication, user settings and authorization are distinct aspects.User settings could easily be stored (identified by user name) using the SqlMembershipProvider with authentication and password management being supplied by Windows. What is the recommended solution for my scenario?

user mapping to a database and role membership to that database

When assigning a 'user mapped Login' to a database and role membership to that database, is it redundent to check/enable db_datareader, db_datawriter as well as db_owner or will check/enable db_owner become all that is necessary to provide role membership to the database?

Create inactive user using the membership provider


Hello all

I have a CreateUserWizard that uses the membership provider and creates a user in a sql server database.

I need to change the IsApproved property on creation to false.

I know that it can be done by createing a custom navigation template... but then i will have to code all the checks for the creation of the user...

Is there any other way to access that attribute?

this is the aspx code:

<asp:CreateUserWizard ID="createUserWizard" runat="server" Font-Names="Verdana" Font-Size="0.7em">
            <SideBarStyle BackColor="#5D7B9D" BorderWidth="0px" Font-Size="0.9em" VerticalAlign="Top" />
            <SideBarButtonStyle BorderWidth="0px" Font-Names="Verdana" ForeColor="White" />
            <ContinueButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid"
                BorderWidth="1px" Font-Names="Verdana" ForeColor="#284775" />
            <NavigationButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid"
                BorderWidth="1px" Font-Names="Verdana" ForeColor="#284775" />

SQL Server Express 2008 idling user logout facility


please let me  know whether there is a  facility in SQL SERVER EXPRESS 2008 to logout idling users automatically.My problem here is that due to limited no of license other needy users can not log in to the system 


Type or namespace membership user cannot be found


- I started an empty ASP.NET 3.5 website

- I included the assembly reference <add assembly="System.Web.ApplicationServices, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

- I included using System.Web.Security;

- I want to use the following code to add a confirmation code to an email

protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
        MembershipUser user = Membership.GetUser(CreateUserWizard1.UserName);
        string code = user.ProviderUserKey.ToString();
        e.Message.Body = e.Message.Body.Replace("<%ConfirmationCode%>", code);

- I know some changes were made to the location of MembershipUser according to this --> http://www.asp.net/(S(ywiyuluxr3qb2dfva1z5lgeg))/learn/whitepapers/aspnet4/breaking-changes#0.1__Toc256770156

Please help!

import user in .net membership


I am tring to import data in .net membership database, i have written some code below that import the user profile that includes






My code works and does imports all the records in membership aspnet_user table but aspnet_Profile table remain empty, and i think that all the profile information should be copied in aspnet_profile.

Below is my code would really appreciate if some one could help...

<?xml version="1.0"?>
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKe

Logout doesn't work on all pages, and also User.IsInRole, UrlRewrting ?



I can't logout from my main page and also from the other pages when I'm using UrlRewriting rule without file extension. If I open the page with .aspx at the end, logout process working just fine. For example:

www.mydomain.com => logout impossible

www.mydomain.com/contakt => logout impossible

www.mydomain.com/contakt.aspx => logout working fine


Also when I log into system, the User.IsInRole method doesn't work for all pages used in application. It's working properly for the pages placed in main folder, but it's not working for the page placed in /folder/subfolder/somepage.aspx . Url showing in browser for this page is www.mydomain.com/somepage . How can I check If user is in role for that page ? It's always return false.

Does anybody got this problem ? How to solve it ? Please share any knowledge..

Referencing the membership user table


When creating a foreign key to the membership user table, is it better to refer to the user_id column or is it ok to use the username column?  I assume that the Membership spec enforces uniqueness in the username since there is a method Membership.GetUser(username) that returns one user.  Using the id is a bit awkward in code because I have to end up casting all over the place like (int)user.ProviderUserKey.  The username would give more information quickly when viewing raw data as well.  Just wondering if someone knows a reason why I shouldn't use it as the foreign key.



Show/Hide fields on InfoPath based on context User Group Membership

I am reading a book on SharePoint 2010 Development by Wrox and although it is a good book, the InfoPath section is limited. I am Googling to see if I can find anywhere where i can perhaps have this type of functionality to hide and show a specific field based on their Group Membership?
Victor Palma

User profile contains correct user but user not showing in audience membership




We have a very strange issue that I am struggling to find an answer to after searching the web.


The issue is that our user profile imports works fine and I can see a specific user correctly.  However, the audience membership which should contain this user doesn't contain the user.

The audience rule is correct (created one called All Staff that looks at the AD global group all staff) and I am expecting the user to be there.  I can see the user in AD in this correct group but sharepoint isn't seeing this.


We only have 1 domain and profile imports works fine as does audience compilation.


I have even compared the AD account to another working one and they are both the same, I even copied an existing working account as a test but still no luck.


Does anyone know what could be the problem?


FYI : We have a MOSS 2007 install updated to on a Win 2008 server.

how to logout a user from an application?



I have created tow forms and applied form authentication by using asp.net config application. When user login, based on the user role form will be redirected to respective form which is consisting its own master page. now, my question is how can user can logout from the application? each master page consist logout button. How can I logout from the application with out going back to the application bt clicking back button in web form?

Membership user in 2010


I'm tryint to convert some existing code to the new framework and according to microsoft the membership stuff has been pushed to System.Web.ApplicationServices so I added the reference and imported the System.Web.Security namespace but MembershipUser continues to error...what am I doing wrong?


MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Choosing Between a User Control or Web Part for SharePoint

SharePoint will only display Web Parts on a page. However, there are publicly available shims that allow you to write user controls and have them be displayed as a Web Part. From SharePoint's point of view, the shim is a Web Part. From the point of view of the user control, the shim is simply a control in .NET that is including the user control

Creating Sites/Lists/List Items under Current User Context in SharePoint By Using SPUserToken

Usually we do this by performing the action under RunWithElevatedPrivileges method and updating the listitem using SPListItem.SystemUpdate() method (see here). but this approach has its own flaws like (RunWithElevatedPrivileges will run under system account, we cannot use SystemUpdate for SPSite,SPWeb,SPList, since it runs under system we will "CreatedBy" by as SystemAccount).
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend