小编cor*_*est的帖子

设置cookie并验证后,User.Identity.IsAuthenticated返回false

我遇到了MVC4用户授权问题.

System.Web.Security.Membership.ValidateUser回报true.
然后它到达FormsAuthentication.SetAuthCookie,我在浏览器中看到一个cookie.
然后由于某种原因User.Identity.IsAuthenticated仍然评估false.
User.Identity.IsAuthenticated重定向后仍然是假的并停留false.

[AllowAnonymous]
[HttpPost]
public ActionResult Login(LoginModel model, string returnUrl)
{
    if (ModelState.IsValid)
    {
        if (System.Web.Security.Membership.ValidateUser(model.UserName, model.Password))
        {
            FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
            if (Url.IsLocalUrl(returnUrl))
            {
                return Redirect(returnUrl);
            }
            else
            {
                return RedirectToAction("Index", "Home");
            }
        }
        else
        {
            ModelState.AddModelError("", "The user name or password provided is incorrect.");
        }
    }

    // If we got this far, something failed, redisplay form
    return View(model);
}
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc asp.net-mvc-4

19
推荐指数
2
解决办法
3万
查看次数

单击时IE11输入宽度会发生变化

所以这只发生在IE11中,我无法弄清楚发生了什么.当我单击input元素(基本上是焦点事件)时,元素的宽度会发生变化.我无法弄清楚CSS来解决这个问题.有人有主意吗?

http://jsfiddle.net/JmRby/2/

<table class="fields" id="EntityDetails_Fields" cellspacing="0" cellpadding="0">
<tbody>
    <tr>
        <td class="Form">Name:</td>
        <td>
            <input name="Name" id="Name" type="text" value="Memorial Park Group" />
        </td>
    </tr>
    <tr>
        <td class="Form">NPI:</td>
        <td>
            <input name="NPI" class="TextBox" id="NPI" type="text" value="" />
        </td>
    </tr>
    <tr>
        <td class="Form">Tax ID:</td>
        <td>
            <input name="TaxIDNumber" id="TaxIDNumber" type="text" value="21-21212121" />
        </td>
    </tr>
    <tr>
        <td class="Form">Medicare:</td>
        <td>
            <input name="MedicareNumber" id="MedicareNumber" type="text" />
        </td>
    </tr>
    <tr>
        <td class="Form">Medicaid:</td>
        <td>
            <input name="MedicaidNumber" id="MedicaidNumber" type="text" value="1234567" />
        </td>
    </tr>
    <tr>
        <td class="Form">In Use:</td>
        <td><span id="InUse"><input name="InUse$ctl00" id="InUse_ctl00" …
Run Code Online (Sandbox Code Playgroud)

html css internet-explorer css3

4
推荐指数
1
解决办法
2408
查看次数

标签 统计

asp.net-mvc ×1

asp.net-mvc-4 ×1

css ×1

css3 ×1

html ×1

internet-explorer ×1