如何重新加载MVC页面?

问题描述 投票:0回答:2

这是一个MVC剃刀页面,在第一次加载时工作正常。如果我使用javascript重新加载甚至刷新浏览器菜单(Chrome),我会在'/'应用程序中收到服务器错误。

>The view 'actionChangeUserSentence' or its master was not found or no view 
>engine supports the searched locations. The following locations were searched:
>~/Views/Conduct/actionChangeUserSentence.aspx
>~/Views/Conduct/actionChangeUserSentence.ascx
>~/Views/Shared/actionChangeUserSentence.aspx
>~/Views/Shared/actionChangeUserSentence.ascx
>~/Views/Conduct/actionChangeUserSentence.cshtml
>~/Views/Conduct/actionChangeUserSentence.vbhtml
>~/Views/Shared/actionChangeUserSentence.cshtml
>~/Views/Shared/actionChangeUserSentence.vbhtml
> and so on...

意思是url字符串被认为是非MVC url。我尝试了几种重装方式,包括:

-location.reload();
-window.location.reload(false); with both false and true
-location.href = location.href;
-history.go(0);

顺便说一下,我需要刷新的原因是除了完整页面(重新)加载之后,在html画布上绘制的js不起作用,原因仍然未知。但无论如何,浏览器菜单刷新当然应该始终有效,我猜...感谢任何帮助。

razor model-view-controller reload
2个回答
© www.soinside.com 2019 - 2024. All rights reserved.