我被分配为现有网站添加新页面,可能是mvc1
我复制了一个页面xyz.aspx的内容,并将新文件xyz1.aspx放在同一个文件夹中
mybasepath / home / xyz工作正常,但mybasepath / home / xyz1不能
我知道asp.net mvc3,4。如果有一个控制器(cs文件)有一个方法索引返回string.empty
然后我们获得该控制器的虚拟URL
但这没有控制器文件夹。所有页面都以root / views / home / xyz.aspx存在。 xyz和xyz1都不包含c#文件后面的代码。
我可能需要做些什么才能使mybasepath / home / xyz1工作,甚至mybasepath / home / xyz_text.txt正常工作
根据SO政策,所有文件都不包含任何特定的页面名称:)
Global.asax中
<%@ Application Codebehind="Global.asax.cs" Inherits="MvcASPCart.MvcApplication" Language="C#" %>
根目录下的Web.Config
<?xml version="1.0"?>
<configuration>
<appSettings>
</appSettings>
<system.web>
<urlMappings enabled="true">
<add url="~/Reviews" mappedUrl="~/Home/Reviews" />
</urlMappings>
<sessionState mode="InProc" timeout="120"/>
<customErrors mode="Off"/>
<httpRuntime requestValidationMode="2.0" />
<compilation debug="false" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
<pages validateRequest="false" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Linq" />
<add namespace="System.Collections.Generic" />
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.web.extensions />
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
<handlers>
<remove name="UrlRoutingHandler" />
</handlers>
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=edge,chrome=1"/>
</customHeaders>
</httpProtocol>
<rewrite>
<rules>
<clear />
<rule name="Redirect to wwww" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^xyz\.com.au$" />
</conditions>
<action type="Redirect" url="xyz.com/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.net>
<mailSettings>
<smtp from="linyongtang1000@163.com" deliveryMethod="Network">
<network host="smtp.163.com" port="25" userName="linyongtang1000" password="2232857" />
</smtp>
</mailSettings>
</system.net>
</configuration>