Ive got an aspx file, containing report viewer and im trying to open the file using controller. If i put the file in the root, it works using redirect but if i placed it in the Views folder, it wont open. Appreciate any help and thank you in advanced for your help.
我有一个aspx文件,包含报表查看器,我试图使用控制器打开文件。如果我把文件放在根目录中,它使用重定向,但如果我把它放在Views文件夹中,它就不会打开。感谢任何帮助,并感谢您的帮助。
1 个解决方案
#1
1
The ~/Views
directory has a directory-specific Web.config
file that adds a rule that prevents all direct-access to files in that directory tree.
〜/ Views目录具有特定于目录的Web.config文件,该文件添加了一个规则,该规则阻止对该目录树中的文件的所有直接访问。
To serve WebForms pages in an MVC project you need to move it to another directory that lacks the Web.config
rule (e.g. ~/Content
), or disable the rule (not recommended).
要在MVC项目中提供WebForms页面,您需要将其移动到缺少Web.config规则的另一个目录(例如〜/ Content),或禁用该规则(不推荐)。
Your .aspx
file doesn't belong in the ~/Views
directory anyway as it is not a View (in the MVC architecture) - it's a "page" :)
您的.aspx文件无论如何都不属于〜/ Views目录,因为它不是View(在MVC架构中) - 它是一个“页面”:)
Note that your project will not work in ASP.NET Core as support for WebForms has been removed in that version.
请注意,您的项目将无法在ASP.NET Core中运行,因为该版本中已删除对WebForms的支持。
#1
1
The ~/Views
directory has a directory-specific Web.config
file that adds a rule that prevents all direct-access to files in that directory tree.
〜/ Views目录具有特定于目录的Web.config文件,该文件添加了一个规则,该规则阻止对该目录树中的文件的所有直接访问。
To serve WebForms pages in an MVC project you need to move it to another directory that lacks the Web.config
rule (e.g. ~/Content
), or disable the rule (not recommended).
要在MVC项目中提供WebForms页面,您需要将其移动到缺少Web.config规则的另一个目录(例如〜/ Content),或禁用该规则(不推荐)。
Your .aspx
file doesn't belong in the ~/Views
directory anyway as it is not a View (in the MVC architecture) - it's a "page" :)
您的.aspx文件无论如何都不属于〜/ Views目录,因为它不是View(在MVC架构中) - 它是一个“页面”:)
Note that your project will not work in ASP.NET Core as support for WebForms has been removed in that version.
请注意,您的项目将无法在ASP.NET Core中运行,因为该版本中已删除对WebForms的支持。