开发者

C#/MVC and RedirectToAction behaviour

开发者 https://www.devze.com 2023-01-18 20:48 出处:网络
I\'ve created MVC2 based solution in 开发者_运维技巧VS2010 using standard template. Site.Master is cleaned a bit, here is how HomeController looks like:

I've created MVC2 based solution in 开发者_运维技巧VS2010 using standard template. Site.Master is cleaned a bit, here is how HomeController looks like:

namespace MvcApplication1.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return RedirectToAction("About");
        }

        public ActionResult About()
        {
            return View();
        }
    }
}

So it simply redirects to About action any time somebody hits Index action. And here I see strange behavior, when I open http://localhost/ (or http://localhost/HomeIndex) first time here is what firebug shows - note that "About" page is duplicated. Can anybody explain why it's happening, it looks like a bug for me.

Screenshot with firebug after redirect

C#/MVC and RedirectToAction behaviour

Upd: It looks ok in Fiddler, this is a bug in Firebug. Thank you for answers.


I doubt that is really happening. Use Fiddler to see what is really happening. I don't trust firebug at all, it lies to me all the time.

If it is happening, it will be something to do with your about view, and not the redirect. what does your view/master look like?


this is a firebug bug:

http://code.google.com/p/fbug/issues/detail?id=1685&q=response&colspec=ID%20Type%20Status%20Owner%20Test%20Summary

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号