0

我因此定义了两条路线:

//Custom route for legacy admin page
      routes.MapPageRoute(
       "LocaliseRoute",                         // Route name
       "Admin/Localise",                // URL
       "~/Views/Admin/Localise.aspx"   // File
       );

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

以下两个 GET 都可以正常工作:

http://pegfect.local/Admin/PegModelUpload
http://pegfect.local/Admin/Localise

但是,前者的形式动作是/Admin/Localise?action=UploadPegModel&controller=Admin

导致“WTF?!”的表达

表格的代码是:

@using (Html.BeginForm("UploadPegModel", "Admin", FormMethod.Post, new { enctype = "multipart/form-data", onsubmit = "return validateForm();" }))
{
  <input type='file' name='file' id='file' />
  <input type="submit" value="submit" />
}
4

1 回答 1

0

答案就在这里:http ://bartwullems.blogspot.co.uk/2011/04/combining-aspnet-webforms-and-aspnet.html

明信片上关于为什么会起作用的答案......

于 2012-08-02T08:17:08.657 回答