不正确的页面加载在MVC [英] Incorrect page loading in MVC

查看:143
本文介绍了不正确的页面加载在MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在主持一个asp.net MVC 2的网站在IIS 6,在这个应用中,我们覆盖创建的Controler方法和配置自定义视图引擎。这台发动机的指定根据URL格式视图的位置。例如;如果用户登陆上www.asite.com/test/1.0/index.aspx
视图引擎告诉MVC寻找的Index.aspx在网站目录/测试/ 1.0 /视图/页/目录;

We are currently hosting a asp.net mvc 2 website in IIS 6. In this application we override the 'Create Controler' method and configure a custom view engine. This engine specifies the location of the views depending on the url format. for example; if a user lands on www.asite.com/test/1.0/index.aspx the view engine tells mvc to look for index.aspx in the 'sitedirectory/test/1.0/views/pages/' directory;

string versionDirectory = String.Format("~/{0}/{1}", offerCode, version.ToString("#0.0000")); 
        ViewLocationFormats = new[]
                                  {
                                      versionDirectory + "/Views/Pages/{0}.aspx",
                                      versionDirectory + "/Views/Pages/{0}.ascx",
                                      "~/Views/Pages/{0}.aspx",
                                      "~/Views/Pages/{0}.ascx",
                                      "~/Shared/Views/{0}.aspx",
                                      "~/Shared/Views/{0}.ascx"
                                  };

        MasterLocationFormats = new[]
                                    {
                                        versionDirectory + "/Views/Layouts/{0}.master",
                                        "~/Views/Layouts/{0}.master"
                                    };

        PartialViewLocationFormats = ViewLocationFormats;

这是我们遇到的问题是,当两个或多个用户登陆该网站在大致相同的时间,
这得到加载的意见,可以绕过切换。但是,这种显示这些视图中的数据是正确的。

The Issue that we are having is that when two or more users land on the site at roughly the same time, the views that get loaded can get switched around. However the data that is shown for those views is correct.

没有任何人有任何想法,为什么这会是这样吗?

does anyone have any ideas why this would be happening?

推荐答案

这是一个(小)已知的问题 - 有一个与缓存回事问题

This is a (little) known issue - there is a problem with caching going on.

看看这篇文章:
http://www.hanselman.com/blog/ABetterASPNETMVCMobileDeviceCapabilitiesViewEngine.aspx

并办理意见。

我最终实现欠,从IViewEngine直接派生,并使用WebFormsViewEngine内部视图引擎。

I ended up implementing owe view engine that derives from IViewEngine directly and uses WebFormsViewEngine internally.

这篇关于不正确的页面加载在MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆