[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Bug encountered when using Visual Studio 2005

Hi,

I am using Visual Studio 2005 to code a web application.  however, due to environment issues, i have to code with ASP.NET 1.1.

When i try to compile this code:




using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Security;
using System.Security.Principal;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Mynamespace
{
    public class cwdWindowsLoginID
    {  
            private string _ID;

            public cwdWindowsLoginID()
            {
                _ID = null;
            }

            public string ID2
            {
                get{
                    string tempUserID = User.Identity.Name;
                    string tempUserID2 = tempUserID.Remove(0,4).ToString().ToLower().Trim();
                    return tempUserID2;
                }
            }

    }
}



I get the following error:   the name 'user' does not exist in the current context.

I have a feeling this has something to do with the fact that User.Identity.Name is an ASP.NET 1.1 technique.

So, my question:  is it possible to change debugging settings to the .net 1.1 framework?  If not, whats the fix?

Thanks
0
alexthecodepoet
Asked:
alexthecodepoet
1 Solution
 
matt3ewCommented:
try HttpContext.Current.User.Identity.Name
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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