context.User.Identity.Name始终在ashx中返回空值

时间:2014-06-27 06:18:00

标签: asp.net

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;

    }

0 个答案:

没有答案