【发布时间】:2015-03-30 13:11:28
【问题描述】:
我的网站目前有一个名为“SYSTEM”的管理员用户,该用户拥有对该网站的完全访问权限,并且能够添加/删除用户凭据。我创建了另一个名为“trainer”的用户,它具有相同的权限级别。但是,当我测试我的 webapp 时,“培训师”用户受到限制,无法添加/删除用户。我的代码在下面,有人可以帮忙吗?
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringBuilder SB = new StringBuilder();
UserModel a = (UserModel)ViewData["UserMaint"];
List<String> UserList = a.getUserList();
List<String> CountryList = a.getCountryList();
SB.Append("<input type=\"hidden\" id=\"UserMaintActionURL\" value=\"");
// SB.Append("<input type=\"hidden\" id=\"User\" value=\"");
// SB.Append(ApplicationUtility.FormatURL("/Stock/Login"));
SB.Append("\" />");
litLoginActionHidden.Text = SB.ToString();
if (ViewData["ERROR"] != null)
{
errormsg.Text = ViewData["ERROR"].ToString();
}
else
{
errormsg.Text = " ";
}
SB = new StringBuilder();
SB.Append("<input type=\"hidden\" id=\"User\" name=\"User\" value=\"" + a.GetCurrentUser().ToUpper() + "\" />");
SB.Append("<select name=\"textUser\" id name=\"textUser\" onchange=\"onChangeUser()\">");
foreach (String element in UserList)
{
if (a.GetCurrentUser().ToUpper()==element.ToUpper()||a.GetCurrentUser().ToUpper() == "SYSTEM" || a.GetCurrentUser().ToUpper() == "trainer")
{
if (a.GetUser().ToUpper() == element.ToUpper())
{
SB.Append("<option value=\"" + element + "\" selected >" + element + "</option>");
}
else
{
SB.Append("<option value=\"" + element + "\">" + element + "</option>");
}
}
}
SB.Append("</select>");
litUserMaint.Text = SB.ToString();
SB = new StringBuilder();
SB.Append("<select name=\"textCntry\" id name=\"textCntry\" >");
if (a.GetCurrentCntry().ToUpper() == "ALL"||a.GetCurrentUser().ToUpper() == "SYSTEM" || a.GetCurrentUser().ToUpper() == "trainer")
{
SB.Append("<option value=\"ALL\">ALL</option>");
}
foreach (String element in CountryList)
{
if (a.GetCurrentCntry().ToUpper() == element.ToUpper() || a.GetCurrentUser().ToUpper() == "SYSTEM" || a.GetCurrentUser().ToUpper() == "trainer")
{
if (a.GetCountry().ToUpper() == element.ToUpper())
{
SB.Append("<option value=\"" + element + "\" selected >" + element + "</option>");
}
else
{
SB.Append("<option value=\"" + element + "\">" + element + "</option>");
}
}
}
SB.Append("</select>");
litCountryList.Text = SB.ToString();
if (a.GetErrorMessage().Trim() != "")
{
StringBuilder ES = new StringBuilder();
ES.Append("<table border=1><tr><td class=\"ErrorText\">");
ES.Append(a.GetErrorMessage().ToString());
ES.Append("</td></tr></table>");
errormsg.Text = ES.ToString();
}
else
{
errormsg.Text = " ";
}
【问题讨论】:
标签: c# visual-studio-2010 web-applications