How to find out the User Name The ASP.NET is run under in the Code

D

David Shvartsman

Hell everyone. We have some problem with the security
while trying to upload files trough the System.IO and
getting the follow error:

DirectoryNotFoundException: Could not find a part of the
path "\\<server name>\share$".]
System.IO.__Error.WinIOError(Int32 errorCode, String
str) +287
System.IO.Directory.InternalCreateDirectory(String
fullPath, String path) +489
System.IO.Directory.CreateDirectory(String path) +195
_ASP.uploadForm_aspx.DoUpload(Object Sender, EventArgs
e) +721
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
+108

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEve
ntHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String
eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277

I was wandering how to find out the User Name The ASP.NET
is run under in the code behind.

Any input would be greatly appreciated
 
K

Konrad Rotuski

Dim authUserName As String
Dim aspUserName As String
authUserName = User.Identity.Name
aspUserName = Principal.WindowsIdentity.GetCurrent.Name
authUserPrincipalLabel.Text = "You are: " & authUserName
aspPrincipalLabel.Text = "This page runs as: " &
aspUserName

goto :
http://support.microsoft.com/default.aspx?scid=kb;en-
us;Q315736&ID=kb;en-us;Q315736&SD=MSDN

for more

hope it helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top