【问题标题】:Web page doesn't load first time around网页第一次没有加载
【发布时间】:2013-10-18 21:28:27
【问题描述】:

我有一个网站(页面源包含在底部),使用 Windows 8.1 / IE11 的用户第一次访问它正确加载的页面,但是当他们点击按钮时它会永远旋转,如果他们刷新它就可以正常工作,或者如果他们第一次访问该页面并打开 DevTools,它也可以工作。此页面适用于除 Windows 8.1/IE11 之外的所有浏览器/操作系统组合,此外,Fiddler 也适用...

我没有 Console.log 语句。由于我无法打开 DevTools 并查看页面旋转等待,因此我不确定如何调试/修复此问题。

任何人以前见过这个,或者能够建议一种调试它的方法?尽管 Post/Get 在一段代码中都返回“View()”,但这是我排除分页错误的方法。据我所知,服务器没有被呼叫击中。浏览器只是旋转(我有一次离开了 30 分钟)。

C#:

public ActionResult Introduction()
{
    if (Request.HttpMethod == "POST")
    {
        var user = DataRepository.GetUser(WebSecurity.CurrentUserName, TaskID);
        if (user.CurrentStep == 3)
        {
            user.CurrentStep++;
            DataRepository.SetUserStep(WebSecurity.CurrentUserId, user.CurrentStep);
        }
        return GetView(user);
    }

    Task task = DataRepository.GetTask(TaskID);
    return View(task);
}

我也试过了:

[HttpGet]
public ActionResult Introduction()
{
    return View(task);
}

[HttpPost]
[ActionName("Introduction")]
public ActionResult IntroductionHttpPost()
{
    return View();
}

查看:

<!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title>Introduction</title>
        <script type="text/javascript">
            document.createElement('header');
            document.createElement('section');
            document.createElement('article');
            document.createElement('aside');
            document.createElement('nav');
            document.createElement('footer');
        </script>


    </head>
    <body>
        <div class="page clearfix">
            <header>
                <div id="progress" class="clearfix">

                </div>
                <div id="title">
                    <h1>Introduction</h1>
                                </div>
            </header>
            <section id="main">


    <form action="/Task/Introduction" method="post">Welcome,    <br />
        <br />
    In this survey you will be asked to answer some questions about yourself and about the kinds of events you enjoy. It is important that you consider each question and answer honestly, we can only accept surveys that are complete and personalized to your preferences.    <br />
        <br />
        <button type="submit" class="button">Start Task</button>
    </form>
            </section>
            <footer>
            </footer>
        </div>
    </body>
    </html>

【问题讨论】:

  • 您是否尝试过使用 log4net 或 elmah 在某些点将其记录到日志文件中?它在兼容模式下工作吗?
  • 它在兼容模式下工作正常。尝试使用 Azure 跟踪,但它似乎没有命中服务器。

标签: c# button razor azure postback


【解决方案1】:

对于遇到此问题的任何其他人,您可以将name 属性添加到您的按钮,一切正常。

【讨论】:

    猜你喜欢
    • 2015-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多