Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Get the identity of the current user in a class

$
0
0

In a .aspx page, I can get the identity of the current user with:

Dim CurrentUser as string = User.Identity.Name

In a class (for example, MyClass.vb), User,Identity.Name gives the error:

"User" is not declared.  It may be inaccessible due to its protection level.

I've tried importing Microsoft. VisualBasics.ApplicationServices to no avail.

Your help would be much appreciated.

Thanking you in anticipation.

Roger

 


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>