routing

Url Routing for unknown number of params

China☆狼群 提交于 2020-01-06 14:07:35
问题 I have seen this post: MVC Handler for an unknown number of optional parameters but it's for MVC and doesn't seem to work for me as I get an error: A path segment that contains more than one section, such as a literal section or a parameter, cannot contain a catch-all parameter. I want to be able to have an indeterminate amount of params in a Url, I have the following route: RouteCollection.MapPageRoute("ManyParam", "{*params}.html", "~/Default.aspx"); This also seems to trigger the error

How to use a cookie in routing configuration in Symfony2?

雨燕双飞 提交于 2020-01-06 07:44:31
问题 I have a City parameter stored in a cookie. I would like to include its value as a pattern prefix in my routing configuration like so: # MyBundle/Resources/config/routing.yml MyBundle_hotel: resource: "@MyBundle/Resources/config/routing/hotel.yml" prefix: /%cityNameFromCookie%/hotel How can I achieve that? 回答1: Give us a use case on how you would want this to work because I don't see the difficulty. Routes are made of parameters that you can specify through the generateUrl function, the url

Angular 5 routing issue

倾然丶 夕夏残阳落幕 提交于 2020-01-06 07:26:16
问题 I am using Angular 5 for my frontend application and Java for the server side stuff. I have an issue with Angular routing. My problem is: When a user enters this URL http://example.net/public/public-data in his browser URL bar and hits enter he gets 404 . Because of this requested resource is not available on the server so to deal with this problem I have written .htaccess the file which redirects each and every request to the index.html page. After this change, the 404 problem is solved but

Angular 5 POST requests for my page

拥有回忆 提交于 2020-01-06 07:21:45
问题 I'm receiving POST request to my Angular page, which might look like: https://www.myangularsite.com/login "POST /login HTTP/1.1 token: randomstring" My app module looks like export const routes: Routes = [ { path: 'login', component: LoginComponent }, { path: '', redirectTo: 'login', pathMatch: 'full' }, { path: '**', redirectTo: 'login', pathMatch: 'full' } ]; @NgModule({ declarations: [ LoginComponent, AppComponent ], imports: [ BrowserModule, HttpClientModule, RouterModule.forRoot(routes,

Angular 5 POST requests for my page

旧时模样 提交于 2020-01-06 07:21:39
问题 I'm receiving POST request to my Angular page, which might look like: https://www.myangularsite.com/login "POST /login HTTP/1.1 token: randomstring" My app module looks like export const routes: Routes = [ { path: 'login', component: LoginComponent }, { path: '', redirectTo: 'login', pathMatch: 'full' }, { path: '**', redirectTo: 'login', pathMatch: 'full' } ]; @NgModule({ declarations: [ LoginComponent, AppComponent ], imports: [ BrowserModule, HttpClientModule, RouterModule.forRoot(routes,

Can I constrain a route parameter to a certain type in ASP.net MVC?

不问归期 提交于 2020-01-06 06:54:49
问题 I have the following route: routes.MapRoute( "Search", // Route name "Search/{affiliateId}", // URL with parameters new { controller = "Syndication", action = "Search" } // Parameter defaults ); Is there a way I can ensure "affiliateId" is a valid Guid? I'm using MVCContrib elsewhere in my site and I'm fairly it provides a way to implement this kind of constraint.... I just don't know what it is! 回答1: You could write regex constraints: routes.MapRoute( "Search", // Route name "Search/

Navigate when clicking on image doesn't work

本小妞迷上赌 提交于 2020-01-06 05:53:13
问题 I've been trying to be able to change screens by clicking on the Image within the code but it isn't working. I've tried defining Push, navigate and other props but it always says that undefined is not an object and show the prop. import React from 'react'; import { AppRegistry, StyleSheet, View, Image, TouchableOpacity, Button } from "react-native"; import { widthPercentageToDP as wp, heightPercentageToDP as hp } from 'react-native-responsive-screen' import { StackNavigator,

Using routes in AngularJS to gather data

旧城冷巷雨未停 提交于 2020-01-06 05:47:05
问题 I have an single page app built on AngularJS which is configured using HTML5 routing. So I use: http://www.example.com/products rather than http://www.example.com/#/products I also have wildcard subdomains affiliates can use for example: http://myaffiliate.example.com And I gather data about myaffiliate from a firebase using this controller: app.controller("ReplicatedController", function($scope, $firebaseObject) { var parts = location.hostname.split('.'); var refSubdomain = parts.shift();

How to keep it CRUD and RESTFull in rails (concrete example)

不羁岁月 提交于 2020-01-06 05:40:07
问题 I've difficulties with keeping my controllers not too complicated and with the basic actions rails creates when we scaffold. Could someone tell me if the approach below is the right one. I've a model Project and those basic routes it: GET /projects -> Project#index GET /projects/new -> Project#new POST /projects -> Project#create GET /projects/:id -> Project#show GET /projects/:id/edit -> Project#edit PATCH /projects/:id -> Project#update PUT /projects/:id -> Project#update Now I would like

Laravel associative array in blade Url

拈花ヽ惹草 提交于 2020-01-06 05:26:06
问题 This is my controller,there is a url issue Priviously i wass passing my data from Model but i face many issues. I want this type of url www.xyz.com/category/subcategory/subsubcategory. then i decide to pass data from controller data was successfully pass to blade , but i dont know how to show data in url. public function search(Request $request, $category_name = null, $subcategory_name = null, $subsubcategory_name = null) { $query = $request->q; $brand_id = $request->brand_id; $sort_by =