Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.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# 使用页面路由的链接存在问题_C#_Asp.net_Routes - Fatal编程技术网

C# 使用页面路由的链接存在问题

C# 使用页面路由的链接存在问题,c#,asp.net,routes,C#,Asp.net,Routes,我正在使用RouteTable为我的站点注册一些路由。现在看起来是这样的: Global.asax void Application_Start(object sender, EventArgs e) { RemoteReaderPlugin.Current.AllowRemoteRequest += Current_AllowRemoteRequest; RegisterRoutes(RouteTable.Routes); } public static void

我正在使用
RouteTable
为我的站点注册一些路由。现在看起来是这样的:

Global.asax

void Application_Start(object sender, EventArgs e)
{    
    RemoteReaderPlugin.Current.AllowRemoteRequest += Current_AllowRemoteRequest;

    RegisterRoutes(RouteTable.Routes);
}

public static void RegisterRoutes(RouteCollection routes)
{
    //routes.Ignore("{resource}.axd/{*pathInfo}");

    //Clan
    routes.MapPageRoute("","Clan/{address}","~/Clan/Default.aspx");
    routes.MapPageRoute("", "Clan/Register", "~/Clan/Register.aspx");
    routes.MapPageRoute("", "Member/GameRanking/{address}", "~/Member/GameRanking.aspx");

    //Member
    routes.MapPageRoute("", "Member/{address}", "~/Member/Default.aspx");
    routes.MapPageRoute("", "Member/Register", "~/Member/Register.aspx");
    routes.MapPageRoute("", "Member/GameRanking/{address}", "~/Member/GameRanking.aspx");

    //Site
    routes.MapPageRoute("", "{address}", "~/{address}.aspx");
    routes.MapPageRoute("", "{address}/{resource}", "~/{address}/{resource}.aspx");
}
当我将浏览器指向
http://localhost:27950/OCDB/Default

但是,当我将浏览器指向
http://localhost:27950/OCDB/
,则我单击的任何链接都会导致此错误:

Server Error in '/OCDB' Application.

The HTTP verb POST used to access path '/OCDB/' is not allowed.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: The HTTP verb POST used to access path '/OCDB/' is not allowed.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[HttpException (0x80004005): The HTTP verb POST used to access path '/OCDB/' is not allowed.]
   System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +2523961
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +301
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034

有没有办法修复这个错误?或者在任何操作之前强制浏览器使用
/Default

如果替换此行,会发生什么情况:

routes.MapPageRoute("", "{address}", "~/{address}.aspx");


希望这将有助于

如果您更换此线路,会发生什么情况:

routes.MapPageRoute("", "{address}", "~/{address}.aspx");

希望这会有所帮助