Note that there are some explanatory texts on larger screens.

plurals
  1. POAuthorization failure after file upload: ASP.NET
    primarykey
    data
    text
    <p>We have a DAT file upload option. We have impersonate true in the web.config.</p> <pre><code>&lt;identity impersonate="true"/&gt; </code></pre> <p>We have granted full control on the folder (to which datfile is uploaded) for the user group in which the user is part of. We have multiple user groups. When users of one group uploads the file, they are getting unauthorized error. Following is the logic. When there happens a postback, they are not authorized. </p> <p>Is it due to impersonation?</p> <p>What could be the reason for this?</p> <p>Is it due to application pool restart?</p> <p>Note: Other group users are able to upload file successfully.</p> <p>Note: We are using IIS 7. ASP.NET impersonation and Windows Authentication are enabled.</p> <pre><code> public bool IsInRole(string ThisRole) { bool validUser = false; WindowsIdentity currentUser = WindowsIdentity.GetCurrent(); WindowsPrincipal MyPrincipal = new WindowsPrincipal(currentUser); Logging.Log("User : " + currentUser.Name.ToString() + " Role: " + ThisRole.ToString() + " Identity: " + MyPrincipal.Identity.ToString() + " -Authendication Started", LogParameters.LogType.Info); if (MyPrincipal.IsInRole(ThisRole)) { Logging.Log("User : " + currentUser.Name.ToString() + " Role: " + ThisRole.ToString() + " Identity: " + MyPrincipal.Identity.ToString() + " -Authendication Sucessful", LogParameters.LogType.Info); validUser = true; Session["UserID"] = MyPrincipal.Identity.Name.ToString(); } else { Logging.Log("User : " + currentUser.Name.ToString() + " Role: " + ThisRole.ToString() + " Identity: " + MyPrincipal.Identity.ToString() + "Authendication Failed", LogParameters.LogType.Info); } return validUser; } string[] keys = ConfigurationManager.AppSettings.AllKeys; string value = string.Empty; AppSettingsReader reader = new AppSettingsReader(); for (int i = 0; i &lt; keys.Length; i++) { value = (String)reader.GetValue(keys[i], value.GetType()).ToString().Replace(":", "").Replace(",", ""); if (!IsPostBack) { bool isUserInRole = false; try { isUserInRole = IsInRole(value); } catch { Response.Redirect("~/Error/Error.aspx?Message=Unauthorized"); } if (isUserInRole) { Session["LastVisitTime"] = DateTime.Now.ToString(); break; } } else { if (Session["UserID"] == null) { NoAccess(); break; } else break; } if (i == keys.Length - 1) Response.Redirect("~/Error/Error.aspx?Message=Unauthorized"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload