开发者

How to find which path the post is routing to MVC Asp.Net

How to find which path the post is routing to MVC Asp.Net

I have a route for posting file's it earlier just had a id parameter so the

global.ascx.cs

use to look like

routes.MapRoute(
                null, // Route name
                "FileUpload/{action}/{id}/{gid}", // URL with parameters
                new { controller = "FileUpload", action = "{action}", id =     UrlParameter.Optional } // Parameter defaults
            );

so on posting a file it used to catch it on the controller action

  public Actio开发者_如何学JAVAnResult CandidatesFileUpload(HttpPostedFileBase uploadFile)
  {
  }

Now I had added another optional parameter on the page with

routes.MapRoute(
            null, // Route name
            "FileUpload/{action}/{id}/{gid}", // URL with parameters
            new { controller = "FileUpload", action = "{action}", id = UrlParameter.Optional , gid=UrlParameter.Optional } // Parameter defaults
        );

now I am not able to catch my post on the above action function or on

    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult CandidatesFileUpload(int id ,HttpPostedFileBase uploadFile)
    {

    }

Where is my post going I am confused , how do I find where is my post going ?


You can also use Glimpse (download it via NuGet). It also has a route debugger. It informs you which route matched your request.


I agree with cgeers - take a look at Glimpse.

In addition to the route debugger, there is also an Execution tab, which shows every method that is run to process your request, including action filters, action results and - what you need - action/controller methods.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜