routing

C#3.5 MVC2 routing skip optional param

让人想犯罪 __ 提交于 2019-12-13 20:34:05
问题 Here I have: routes.MapRoute( "test", // Route name "DataWarehouse/Distribution/{category}/{serialNo}", new { controller = "DataWarehouse", action = "Distribution", category= UrlParameter.Optional, serialNo = UrlParameter.Optional } ); Category and serialNo are both optional params. When the routing is like: DataWarehouse/Distribution/123 , it always treat 123 as the value for category. My question is how I can make it to know the 1st param could be either category or serialNo, i.e.

Many router outlets in Angular 6

送分小仙女□ 提交于 2019-12-13 20:21:55
问题 In my app I have two main parts: Authorization - login and registration pages Panel - basic app pages In my app.component.html I have router outlet for navigation to Authorization and Panel components. However in the mentioned components I have another router outlets for navigation between cards (subcomponents). I tried to do routing separetly for each module, but it doesnt work. When I go to path eg. "/authorization/login" I got error that such url doesnt exists. Here is my app-routing

Redirect to Home/Index when page not found

谁都会走 提交于 2019-12-13 19:02:14
问题 This has already been asked here but I was hoping there was a nicer "routing" way to do this. Essentially I want to redirect to the Home/Index page when a user enters an incorrect url in my site. EDIT I'm using IIS. 回答1: IMHO the best way will be to use Home/Index as 404 error handling page. So user will be redirected to a home page each time 404 is returned. <?xml version="1.0"?> <configuration> <system.web> <!-- For IIS6 and Cassini --> <customErrors mode="RemoteOnly"> <error redirect="Home

laravel load view from a folder name with actual dot

我只是一个虾纸丫 提交于 2019-12-13 18:56:14
问题 I am creating a multi-domain Laravel app, so my view files are in separate folders per domain. For example, the following: return view('pages/' . $_SERVER['SERVER_NAME'] . '/public/home', []); should load a view under pages/domain.com/public/home.blade.php but instead it attempts to load pages/domain/co/public/home.blade.php because of the dot notation. How do I get around this? 回答1: You'd need to add a view namespace to set up hints for a particular folder if there're dots in the name.

Rails 3.1 - in routes.rb, using the wildcard, match '*' is not catching any routes

爱⌒轻易说出口 提交于 2019-12-13 18:31:06
问题 In my pages_controller.rb file I have a not_found action. I want to have any route that is not matched by an entry in my routes.rb file to go to pages#not_found . Wanting to leverage a wildcard, I made this the last line of my routes.rb file: match '*' => 'pages#not_found' I'm basing this on what I read about wildcards in the ruby guide for routing (http://guides.rubyonrails.org/v3.1.0/routing.html). However it is not working. Instead of going to pages#not_found , I get: AcctionController:

MVC 5 Web Attribute Routing is not working

自作多情 提交于 2019-12-13 17:36:56
问题 I implemented the Attribute routing in my Application and after that when I started nothing was working as planned. Only the Json Results works rest is not working as expected. [RoutePrefix("ProductCategory")] public class CategoryController : Controller { [Route("CategoryMain")] // GET: /Category/ public ActionResult Index() { var cat = categoryService.GetCategories(); if (Request.IsAjaxRequest()) { return PartialView("Index", cat); } return View("Index", cat); } } Error Server Error in '/'

ASP.NET Webforms routing with extension

[亡魂溺海] 提交于 2019-12-13 16:45:21
问题 I have a simple ASP.NET Webapplication project with url-routing and want to "allow" routes with the fileextension like ".html", e.g... http://www.mywebsite.com/cms/test.html http://www.mywebsite.com/cms/sub/test.html http://www.mywebsite.com/cms/sub/sub/test.html My global.asax routes looks like this: routes.MapPageRoute("", "cms/{a1}", "~/default.aspx"); The route is matched with when i access the website like this: http://www.mywebsite.com/cms/test If i try this one, it doens't work too:

Magento 2.1.2 Rourter action factory gets in to an infinite loop

可紊 提交于 2019-12-13 16:12:30
问题 I am working on developing a module in magento2.The problem is with the routing-where the router return $this->actionFactory->create('Magento\Framework\App\Action\Forward'); does not redirect to my module,contorller and the action specified in the code;it thorws an exception Front controller reached 100 router match iterations.Any help would be highly appreciated.Thanks in advance! public function match(\Magento\Framework\App\RequestInterface $request) { $identifier = trim($request-

Prefix route name without prefixing URI in Laravel

久未见 提交于 2019-12-13 16:02:03
问题 I have two namespaces 'Front' and 'Admin' . For 'Admin' namespace it is OK to have all paths prefixed with admin.conrtoller.action , but for 'Front' I want to have prefixed route names without prefixed URIs. Route::group(array('namespace' => 'Front'), function() { Route::resource('franchising', 'FranchisingController', array('only' => array('index'))); }); This generates me franchising.index root name and get 'franchising' URI. How to make all resources in this group to generate route names

When HTTP-POST has body, url parameter is null

我们两清 提交于 2019-12-13 16:01:56
问题 This is self-hosted RESTful MVC4 Web API, the only route is api/{controller}/{state} . When I send an HTTP-POST that has a body, the state argument comes in null. If I remove the body the state variable is present. The way I thought it worked for HTTP-POST was that the url parameters get mapped then the body gets serialized into the extra parameter, which in this case is data parameter. The content is just string data which I had to write a custom MediaTypeFormatter (which I thought was odd