Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Full Path to Context.User.Identity.Name

Status
Not open for further replies.

onedizzydevil

Programmer
Mar 24, 2001
103
US
I keep trying to user this:

Context.User.Identity.Name

in a class file but it keep coming up with a blue squiggly under the Context and says:

Name 'Context' is not declared.

Any ideas, I had the same problem with Response.Cookies but, I was able to figure out the full path which is:

System.Web.HttpContext.Current.Response.Cookies

But I can not seem to find the utter one, yet. Wayne Sellars

"Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0."
 
Response.Cookies is in the:

System.Web.HttpContext

namespace. Therefore, if you put the following statement at the top of your code behind page:

Imports System.Web.HttpContext

you can then just refer to Response.Cookies

Same with other things, such as the SqlCommand object:

Imports System.Data.SqlClient '<---namespace

and you can then just:

Dim cmd As SqlCommand

instead of:

Dim cmd As System.Data.SqlClient.SqlCommand

You can set up your own namespaces, too. Check out the docs for more specifics, or (of course) you can post back here, too.

As for your first question, I'm unfamiliar with that. What's it supposed to do? My guess is that you'll need to add a reference to a .NET assembly in your project before you can use it. You may have to import a namespace to qualify it, too.

For starters, you can open your object browser, and search for what you're looking for... I came up with a few matches, but since I'm not sure what I'm looking for, I wasn't able to narrow my choices.

Post back with more specifics if you can't figure it out.

:)
paul
penny1.gif
penny1.gif
 
Okay, well the Object Browser if not helping for this. I have imported about twenty different things and it is not working.

I have one project that it is working with and another project that it is not. The first project is a website and second project is a class file. But should not matter bc the website uses code behind and will be converted to a class file anyway. And if I import and reference everything (I see) the first project does it still does not work. This makes absolutely no logical since. Wayne Sellars

&quot;Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0.&quot;
 
I did not find the answer but I did find a work around for what I was attempting to do.

There is no need to waste any more time on this. I appreciate the help.

Wayne Sellars

&quot;Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top