Professional Web Applications Themes

How to find out the User Name The ASP.NET is run under in the code - ASP.NET Security

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.IPo stBackEve 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...

  1. #1

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

    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.IPo stBackEve
    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

    David Shvartsman Guest

  2. #2

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

    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.IPo stBackEve
    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

    David Shvartsman Guest

  3. #3

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


    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 :
    [url]http://support.microsoft.com/default.aspx?scid=kb;en-[/url]
    us;Q315736&ID=kb;en-us;Q315736&SD=MSDN

    for more

    hope it helps
    Konrad Rotuski Guest

  4. #4

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

    Thanks a lot. Has been a great help.

    David
    David Shvartsman Guest

Similar Threads

  1. Need code to find 2-day old files
    By Adams-Blake Co. in forum PHP Development
    Replies: 2
    Last Post: January 7th, 12:32 AM
  2. I can find it, why can't my code?
    By PaulNaude in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: October 12th, 01:40 PM
  3. Replies: 1
    Last Post: January 31st, 07:44 PM
  4. bug in code - can't find it!
    By Amanda McComb in forum PHP Development
    Replies: 3
    Last Post: August 7th, 01:03 PM
  5. [PHP] bug in code - can't find it!
    By Amanda McComb in forum PHP Development
    Replies: 2
    Last Post: August 6th, 09:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139