Trying to find user

Posted on 2012-09-12
Last Modified: 2012-09-12
I have moved my small homepage from Windows XP IIS to Windows 7 IIS.

I have this:

if (HttpContext.Current.User.Identity.Name.Contains(strPreWindows.TrimEnd()))
   Do this
   Do that
   Response.Redirect("info.aspx?id=updatenotallowed", false);

Open in new window

I did not have any problem to retrieve the user by using this: HttpContext.Current.User.Identity.Name

The content was for an exampel: AD\\DKSOKVK

"strPreWindows" I get from a DB

Now "HttpContext.Current.User.Identity.Name" is empty.

First I thought it was because I didn't have Windows Authentication enabled, but it is enabled.

Can anyone help me?
Question by:QC20N
    LVL 19

    Accepted Solution

    Check out this link:

    Seems to be the same issue. You need to ensure you are not allowing anonymous access.
    LVL 8

    Expert Comment

    Which authenticate mode do you use in file web.config ? If it is Forms, you sould change it to Windows

    <authentication mode="Forms"/>


    <authentication mode="Windows"/>
    LVL 26

    Expert Comment

    by:Alan Warren
    Are you using a SQL db or Access db for your membership?

    Check the aspnet_Applications table and the aspnet_membership table, we are looking for discrepancy with the ApplicationID field in aspnet_membership, they should all be the same as the ApplicationID in aspnet_Applications.

    Had a similar issue some time ago, using Forms Authentication for some reason the app started reporting a new and different Membership.ApplicationName and subsequently, when a new user was created, a new ApplicationID. The new user able to login, but the existing users could not, because the combination of UserID and ApplicationID being passed by the membership provider, didn't match any UserID and ApplicationID combinations in the db.

    I know you are using Windows Authentication, but wondering if the domain part of your login has changed "AD\\"; and is subsequently being interpreted as a different ApplicationID.

    Try creating a new user, check the applicationID of the new membership user against the existing membership user record.


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    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…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    729 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

    19 Experts available now in Live!

    Get 1:1 Help Now