简体   繁体   中英

C#/MVC and RedirectToAction behaviour

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 替代文字

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM