Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 独立页面url/编码/呈现问题_C#_Asp.net_Asp.net Mvc_Razor - Fatal编程技术网

C# 独立页面url/编码/呈现问题

C# 独立页面url/编码/呈现问题,c#,asp.net,asp.net-mvc,razor,C#,Asp.net,Asp.net Mvc,Razor,我目前正在开发一个成熟的MVC应用程序,我有一个独立的razor视图文件夹,其中只有一个razor sharp html文件 只是想说明一下,该项目的简化结构如下: 根 控制器文件夹 模型文件夹 视图文件夹 飞溅文件夹 index.cshtml 在splash中,只有一个index.cshtml文件和用于该页面的一些js/css文件夹 我在web.config中添加了这一行,以使index.cshtml呈现为独立页面 <add key="webpages:Enabled" value="t

我目前正在开发一个成熟的MVC应用程序,我有一个独立的razor视图文件夹,其中只有一个razor sharp html文件

只是想说明一下,该项目的简化结构如下:

根 控制器文件夹 模型文件夹 视图文件夹 飞溅文件夹 index.cshtml 在splash中,只有一个index.cshtml文件和用于该页面的一些js/css文件夹

我在web.config中添加了这一行,以使index.cshtml呈现为独立页面

<add key="webpages:Enabled" value="true" />
现在这一切都很好,但这里来的wierd部分。 当我调试模式并导航到localhost:44300/splash/时,页面呈现良好,而不向url添加index.cshtml;当我到达localhost:44300/splash/index.cshtml时,页面呈现良好

但是当我发布页面时,我需要整个URL,包括.cshtml,以便将其呈现为razor视图页面。如果我只是转到domain/splash/它呈现为wierd普通html页面,它看起来像。但是如果我访问domain/splash/index.cshtml,它就可以正常工作


所以问题是,我如何让它只导航到domain/splash/就可以将页面完美地呈现为锋利的html?如果可能,当您转到domain/splash/index.cshtml时,将url更改为domain/splash/

是splash文件夹中的web.config还是根目录中的web.config?必须检查您的输出路由。根目录中只有一个web.config文件。它也是视图文件夹中的一个web.config文件。线路也在那里。你能说得更具体点吗@Inanikian?我该怎么做?我的输出路线?我没有在route.config文件中添加特殊路由。但是我不认为它会使用这里指定的路由。你为什么不创建一个名为splash的控制器,并在Global.asax.cs中将其设置为默认值?