routing

Asp.Net System.Web.Routing won't route URL unless .aspx in on the end

谁说胖子不能爱 提交于 2019-12-05 21:03:28
I have a weird problem with routing. I have an existing website that I am trying to add this to. It works, but only if .aspx is on the end of the URL. If I remove the .aspx, it gives me an error: "The resource cannot be found." I created a quick test website and copied the code over to it, it works just fine. The code between the 2 are identical. Both are running on the VS 2008 web server. I just don't get it. Any ideas? Thanks, Vincent Okay, I found the problem. I don't understand why this caused the problem, but if there is a period (.) anywhere in the URL, it errors. I had this: http:/

Redirection in Rails 4 routes

廉价感情. 提交于 2019-12-05 20:33:23
My site used to have a mobile view here: https://www.example.com/m/home We have deprecated the mobile views and now I need a simple way to trim the /m/ off the URL so that the request proceeds to the correct page. Example: https://www.example.com/m/about => https://www.example.com/about https://www.example.com/m/user/:id => https://www.example.com/user/:id I'm hoping to solve this in the Rails routing without having to introduce a new controller action or meddle with nginx. I have 100+ routes. Thanks in advance. Rails version: 4.2 There is a redirection module (also documented in the guide ).

Dynamic routing in CakePHP

牧云@^-^@ 提交于 2019-12-05 20:15:29
I'm trying to set dynamic routes for small CMS. Is there proper way how to do it? I founded somewhere this soliution, but honestly I'm not satisfied with it. CMS have other content types so define this for every model does't seem right to me. $productsModel = ClassRegistry::init('Product'); $products = $productsModel->find('all'); foreach($products as $product){ Router::connect('/produkty/:id/'.$product['Product']['url'], array('controller' => 'products', 'action' => 'view',$product['Product']['id'])); } Thanks for any help! No need to do anything complex :) In routes.php: Router::connect('

Symfony 2.0 - How to create route with array-parameters?

烈酒焚心 提交于 2019-12-05 19:58:39
I want to create a route, that matches on an array. example: Name_show: pattern: /Name/{names} defaults: { _controller: testBundle:Name:showNames } where {names} holds an array of names, like: array([1] => 'Thomas', [2] => 'Anton', [3] => 'Berta'); How to handle this? Symfony 2.0 responses with Warning: preg_match() expects parameter 2 to be string, array given can't find any solution in symfony doc. You can use it as a string and just serialize() the content before and after. As far as I know symfony2 doesn't allow arrays in routing, how would the URL Look with an array in? A URL has to be a

Add route programmatically in C++ using ioctl

≯℡__Kan透↙ 提交于 2019-12-05 19:29:21
I've written simple C++ function, that adds new route: void addRoute() { int fd = socket( PF_INET, SOCK_DGRAM, IPPROTO_IP ); struct rtentry route; memset( &route, 0, sizeof( route ) ); struct sockaddr_in *addr = (struct sockaddr_in *)&route.rt_gateway; addr->sin_family = AF_INET; addr->sin_addr.s_addr = inet_addr( "192.168.20.1" ); addr = (struct sockaddr_in*) &route.rt_dst; addr->sin_family = AF_INET; addr->sin_addr.s_addr = inet_addr( "10.0.0.50" ); addr = (struct sockaddr_in*) &route.rt_genmask; addr->sin_family = AF_INET; addr->sin_addr.s_addr = INADDR_ANY; route.rt_flags = RTF_UP | RTF

Relative paths in IIS 7 Web applications under a website

≯℡__Kan透↙ 提交于 2019-12-05 19:27:33
Is there a way to force "Paths" in a web-application under a website to resolve to actual paths under the app, rather than the site? I'm new so I can't upload an image of what I'm talking about, but see if you can visualize my IIS setup: IIS 7.0 ----MAIN WEB SITE: ----Web App #1 ----Web App #2 Each web app has its own CSS, pointing to its own images; for example in Web App #1: background-image: url(images/someimage.png) The problem is, since web app is installed under a main site, "images/someimage.png" resolves to the image folder of the main site, not web app #1. How can I fix this? Try this

how to set the routing translation based on annotation?

醉酒当歌 提交于 2019-12-05 19:04:16
All the routing of my website is realized based on the annotations. Now, I want to translate my routing. To realize that, I tried to use the bundle JMSI18nRoutingBundle . Nevetheless, the documentation does not give any example how to specify the route for each locale. This is an action with its routing, how to translate it? /** * @Route("/welcome", name="welcome") * @Template() */ public function welcomeAction() { return array(); } Thanks, Question after being edited /** * @Route("/welcome", name="welcome", defaults={"_locale" = "en"}) * @Route("/bienvenue", name="welcome", defaults={"_locale

How to access Java servlet running on my PC from outside?

十年热恋 提交于 2019-12-05 18:45:50
I used Netbeans6.7 to write a servlet, when it runs, it opens a browser window with this address : http://localhost:8080/My_App/Test_Servlet , I replaced the "localhost" with my IP address, now it looks like this : http://192.???.1.??:8080/My_App/Test_Servlet , but I tried to access it from another computer outside my home, it can't read anything, I wonder if I need to change Windows Fire Wall setting to allow outside traffic, it's a Paypal IPN app, so I call Paypal, they said they can't access : http://192.???.1.??:8080/My_App/Test_Servlet What on my side should I do to allow traffic from

Get “Default” Route Url in Controller

你说的曾经没有我的故事 提交于 2019-12-05 18:37:54
Can anyone tell me what is the syntax for retreiving the actual URL for the "Default" Route? I'd like to do something like: string url = RouteTable.Routes["Default"].ToString(); //(even though that code is completely wrong) so that I could have the url value of the route available to work with. So far, I've been trying the .GetVirtualPath() method, but that only returns the route data for the current controller. thanks Dave A route can match any number of urls. So a route doesn't have a url. To get a url from a route you will have to supply it with the route data that you want the url for. To

Angular2 Can't resolve all parameters for RouterOutlet: (RouterOutletMap, ViewContainerRef, ?, name)

落花浮王杯 提交于 2019-12-05 18:33:48
I'm totally new to any JS framework. Just started learning Angular 2. I'm doing some basic app for internship. From angular app I post name to Java controller, that get's info needed and sends it back. Basically fun happens when name is 'Dave' or 'Hal'. All looks fine, but when I run server and try to get to my app, I get EXCEPTION: Error: Uncaught (in promise): Can't resolve all parameters for RouterOutlet: (RouterOutletMap, ViewContainerRef, ?, name). As far as I can tell from documentation, the missing parameter is componentFactoryResolver . How to get rid of this error and run it all