Membership.GetUser() method returns null

Posted on 2009-02-10
Last Modified: 2013-12-17
I am using forms authentication....and trying to lockdown a folder using roles.

Membership.GetUser() return null when web.config is <deny users="?"/>
but works fine when web.config   <deny users="*"/>

Why is this?

Question by:mugsey
    LVL 7

    Expert Comment

    "*" will deny all users, and "?"  will deny anonymous users

    Author Comment

    Yes but I do authenticate

    this code is executing fine

     if (Membership.ValidateUser(LoginUserName, LoginPassword))
                e.Authenticated = true;            
    LVL 7

    Accepted Solution

    and have you checked Membership.GetUser() in the code?

     if (Membership.ValidateUser(LoginUserName, LoginPassword))
                // check Membership.GetUser()  here because setting e.Authenticated  to true
                e.Authenticated = true;            

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now