How to open MVC5 view from aspx page

匆匆过客 提交于 2019-12-12 06:46:41

问题


Ive got an aspx file on the root of web application MVC5 project. I can go from Mvc View to the aspx file but im stuck on going back to mvc view. How do i go back from button event in Aspx? Fyi, this is just an empty project as im trying to learn on MVC. So everything is left as it is. Default configuration. The only difference that ive made is add redirect to the aspx page inside Home controller ActionResult.

Folder Structure and redirect code.

p/s. If you are wondering why i used an aspx file inside my mvc, im trying to do dynamic rdlc reporting using reportviewer. Im not sure if it could be done using mvc view. As far as i know, razor engine could not use reportviewer and thats why i use an aspx file. Im probably wrong on this as im still very new in doing MVC. Tqvm in advanced.


回答1:


Try this:-

First change your current code

public RedirectResult Report()
{
    return Redirect("~/ReportWebForm.aspx");
}

And in your .aspx page, add

Response.Redirect("/Controller/Action")


来源:https://stackoverflow.com/questions/40609293/how-to-open-mvc5-view-from-aspx-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!