routes

HttpModule only on specific MVC route

安稳与你 提交于 2019-12-01 23:35:22
问题 I have a custom IHttpModule that I would like to only work on a specific route. For example : http://example.com/HandleAzureTask I want this module to only be invoked/handled on the /HandleAzureTask route. Since this is not a controller, I can't really set the [Authorize] attribute on it; how can I force it only to be invoked/handled if user is authenticated? I am on ASP.NET MVC 4 and currently have my module added to web.config as such: <modules> <remove name="AzureWebDAVModule" /> <add name

Run rails app under subfolder

我是研究僧i 提交于 2019-12-01 23:04:52
I've been testing my rails app on localhost:3000 and it works just fine. However, when deploying to my host, the root URL is: http://99.88.77.66/~username I do not have a domain name at this point. When I point the browser to the above URL I get the root not found for: /~username Alternatively for http://99.88.77.66/~username/controller/index I get this route not found: /~username/controller/index I'm using Rials 4.2.3 and Ruby 2.0. How can I make my routes work with this kind of subfolder until I can get an appropriate domain name? Try setting config.relative_url_root in config/environments

KMLViewer Apple's example not working

徘徊边缘 提交于 2019-12-01 21:31:52
I've been searching for quite sometime an answer to my problem with no success. So here it goes... KMLViewer, Apple's example is not working in some cases. After executing the README steps, i've tried to build up a route between Lisboa, Portugal and Porto, Portugal. And here the strangest thing happens. The annotations are built correctly, although the overlay (MKPolyline) does not, it only draws part of the route and it starts drawing in the middle of an "annotation". What am i missing ? You can try, Madrid - Barcelona, you have also the same issue. Thanks in advance for spending sometime in

Find default gateway ip address, rather than parsing proc filesystem

会有一股神秘感。 提交于 2019-12-01 21:19:53
How should I obtain the ip address of default gateway ? Rather than read entries from /proc , is there any standalone API useable ? you can use libnl which is a library to communicate with the kernel via NETLINK sockets. a simple example to get the default route would be (please add error checking and the needed headers) void cb_route (struct nl_object *cb, void *arg) { struct rtnl_route *route = (struct rtnl_route*) cb; /* do what you need to do with rtnl_route object * e.g. copy it to arg, etc. */ struct nl_addr *tmp_addr; tmp_addr = rtnl_route_get_gateway(route); len = nl_addr_get_len(tmp

Create Route for a specific URL without changing the URL with MVC

╄→尐↘猪︶ㄣ 提交于 2019-12-01 18:20:11
I have a MVC Web Application that runs on www.domain.com and I need to configure a different URL binding for another domain www.domain2.com for the same web application. The new domain www.domain2.com will have to return a specific Controller Action View like /Category/Cars : routes.MapRoute( name: "www.domain2.com", url: "www.domain2.com", defaults: new { controller = "Category", action = "Cars", id = UrlParameter.Optional } ); How can I achieve this without changing the URL, so the visitor inserts the url www.domain2.com and receives the view www.domain.com/category/cars but the url remains

Laravel: POST method returns MethodNotAllowedHttpException

我与影子孤独终老i 提交于 2019-12-01 18:18:47
I have a POST route in my api.php file, and it is like this: Route::group( ['namespace' => 'api'], function () { Route::post('parent/signup', 'ParentController@signUp'); } ); And I am trying to access this url in postman as this is an api route. But when I send request to this route , this exception occurs: MethodNotAllowedHttpException in RouteCollection.php line 218: I am definitely sending a post request as shown in the shot below: I ran php artisan route:list and this route is a POST one. | POST | api\/parent\/signup | | App\\Http\\Controllers\\api\\ParentController@signUp What am I doing

Laravel: POST method returns MethodNotAllowedHttpException

半城伤御伤魂 提交于 2019-12-01 17:44:28
问题 I have a POST route in my api.php file, and it is like this: Route::group( ['namespace' => 'api'], function () { Route::post('parent/signup', 'ParentController@signUp'); } ); And I am trying to access this url in postman as this is an api route. But when I send request to this route , this exception occurs: MethodNotAllowedHttpException in RouteCollection.php line 218: I am definitely sending a post request as shown in the shot below: I ran php artisan route:list and this route is a POST one.

Serve multiple Angular apps from the same server with Nginx

陌路散爱 提交于 2019-12-01 16:17:18
I'm serving multiple angular apps from the same server block in Nginx . So in order to let the user browse directly to certain custom Angular routes I've declared without having to go through the home page (and avoid the 404 page), I'm forwarding these routes from nginx to each angular app's index.html , I've added a try_files to each location : server { listen 80; server_name website.com; # project1 location / { alias /home/hakim/project1/dist/; try_files $uri /index.html; } # project2 location /project2/ { alias /home/hakim/project2/dist/; try_files $uri /index.html; } # project3 location

Rails Routes - How to make them case insensitive?

安稳与你 提交于 2019-12-01 15:40:51
Routes in Ruby on Rails are case sensitive. It seems someone brought this up before, and it has been labeled will not fix. http://rails.lighthouseapp.com/projects/8994/tickets/393-routes-are-case-sensitive That strikes me as unfortunate, as I don't really see any upside on my own application for routes to be case sensitive, while on the downside it creates a potential for confusion and a general appearance of lack of polish in my opinion. What's the best way to make my routes case insensitive? I found this tip on a Google search: map.connect "web_feeds/:action", :controller => 'web_feeds',

Flask route giving 404 with floating point numbers in the URL

只谈情不闲聊 提交于 2019-12-01 15:30:33
I have the following route definition in my Flask app's server.py: @app.route('/nearby/<float:lat>/<float:long>') def nearby(lat, long): for truck in db.trucks.find({'loc': {'$near': [lat, long]}}).limit(5): if truck.has_key('loc'): del truck['loc'] return json.dumps(trucks) But when I go to http://localhost:5000/nearby/37.7909470419234/-122.398633589404 , I get a 404. The other routes work fine, so it's an issue with this one. What am I doing wrong here? The built-in FloatConverter does not handle negative numbers. Write a custom converter to handle negatives. This converter also treats