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

  • Thread starter Thread starter David Shvartsman
  • Start date Start date
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
 
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

Back
Top