Я запускаю свой проект по сравнению с 2013 Webforms.Framework 4.5.Я использую библиотеку Microsoft.AspNet.FriendlyUrls. Я пробую ее в первый раз, и я пробую все, но не получаю успеха. Я не знаю, в чем проблема. Я пробовал те же самые коды в примерах, я пробовал разные коды, но это не работает.
Мой Global.asax
public class Global : NinjectHttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
protected void Application_Error(object sender, EventArgs e)
{
var httpException = Server.GetLastError() as HttpException;
if (httpException != null && httpException.GetHttpCode() != 404)
{
typeof(CustomErrorHandler).ToString();
(new CustomErrorHandler()).Process(Context);
Response.End();
}
}
protected override void OnApplicationStarted()
{
base.OnApplicationStarted();
BundleTable.EnableOptimizations = FrSettings.Settings.BundleJsAndCss;
BundleConfig.CssBundle();
BundleConfig.JsBundle();
}
protected override IKernel CreateKernel()
{
return IoC.Container;
}
}
Мой файл веб-конфигурации:
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Glav.CacheAdapter.MainConfig" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<section name="FrSettings" type="VDershane.Base.WebForms.Configuration.FrSettings,VDershane.Base" />
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
</configSections>
<appSettings>
<!--Cache Timespan süresi-->
<add key="CacheTimeSpan" value="24" />
<!--Cache Timespan süresi-->
</appSettings>
<FrSettings configSource="Yaz.config" />
<connectionStrings configSource="ConnectionStrings.config" />
<system.web>
<httpHandlers>
<add path="yazfr.ashx" verb="*" type="VDershane.Base.WebForms.Handler.YazFrHandler,VDershane.Base" />
<add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />
</httpHandlers>
<sessionState timeout="20"></sessionState>
<globalization culture="auto" uiCulture="auto" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<customErrors mode="Off" />
</system.web>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
<add name="X-Frame-Options" value="SAMEORIGIN" />
<add name="X-XSS-Protection" value="1" />
</customHeaders>
</httpProtocol>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="frhandler" path="yazfr.ashx" verb="*" type="VDershane.Base.WebForms.Handler.YazFrHandler,VDershane.Base" />
<add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
</handlers>
<staticContent>
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
</system.webServer>
<dotless minifyCss="false" cache="true" web="false" strictMath="false" />
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
А это мой класс:
public static class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
var settings = new FriendlyUrlSettings();
settings.AutoRedirectMode = RedirectMode.Permanent;
routes.EnableFriendlyUrls(settings);
routes.MapPageRoute("", "HomePage", "~/Default.aspx");
Пожалуйста, помогите мнея действительно сумасшедший. Мой путь к файлу default.aspx
C: \ Users \ alican \ Documents \ Visual Studio 2013 \ Projects \ DataRecovery \ DataRecovery.UI \ Default.aspx