context.User.Identity.Name始终在ashx中返回空值
的Login.aspx:
protected void Button1_Click(object sender, EventArgs e)
{
if (userName.Text == "admin" && password.Text == "admin")
{
FormsAuthentication.SetAuthCookie(userName.Text, false, FormsAuthentication.FormsCookiePath);
Response.Redirect("ManageIndex.aspx");
}
}
ASHX:
/// <summary>
/// Summary description for TransactionRecordList
/// </summary>
public class TransactionRecordList : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string A= context.User.Identity.Name;
}