Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 512
  • Last Modified:

Trying to find user

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?
1 Solution
Daniel Van Der WerkenIndependent ConsultantCommented:
Check out this link:

Seems to be the same issue. You need to ensure you are not allowing anonymous access.
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"/>
Alan WarrenCommented:
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

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now