routing

Session is null in IRouteHandler.GetHttpHandler with Asp.net routing

扶醉桌前 提交于 2019-12-04 01:32:57
问题 I'm trying to get Session enabled in the GettHttpHandler method of my IRouteHandler classes but session is always null. Could someone tell me what I'm doing wrong? In global.asax I have RouteTable.Routes.Add("All", new Route("{*page}", new MyRouteHandler())); The MyRouteHandler class where Session is null looks like this: public class MyRouteHandler : IRouteHandler, IRequiresSessionState { public System.Web.IHttpHandler GetHttpHandler(RequestContext requestContext) { string test = HttpContext

GraphHopper vehicle=car works but foot or bike don't work

放肆的年华 提交于 2019-12-04 01:24:35
问题 I have an issue with the GraphHopper routing engine stable version 0.5 I can get directions when using the vehicle=car , but this fails with bike and foot . Here is an example of a roughly 3-minute walk on GraphHopper Maps: This yields a result on the map, which is great. I have used the exact same coordinates when running this locally, to obtain the JSON data as follows: http://localhost:8989/routes?point=-33.916567%2C18.417914&point=-33.917584%2C18.418935&locale=en-US&vehicle=foot This

Ignore folder in ASP .NET MVC

匆匆过客 提交于 2019-12-04 00:52:34
问题 I have an existing ASP .NET MVC application and I would like to ignore a specific folder within it (where I intend to put PHP scripts). I have tried adding an ignore route as described here but it is not working because I am still getting standard ASP .NET configuration errors. For examples sake, imagine I have this folder structure: root+ | +--bin | +--test Based on my understanding, in my global.asax.cs file I think I should be putting this in the RegisterRoutes method: routes.IgnoreRoute(

Troubleshooting “The controller for URI is not callable” error

我们两清 提交于 2019-12-03 22:13:21
I'm working on Symfony 2.3 and I declared a new route and new controller , but when I call this controller from the browser I get this error: The controller for URI "/user/1" is not callable. in /dev.mydomain.org/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php at line 82 This is my simple route configuration: user_homepage: pattern: /user defaults: { _controller: UserBundle:Default:index } user_show: pattern: /user/{id} defaults: { _controller: UserBundle:Default:show } requirements: id: \d+ And this is my very simple controller : public function

alias url with sinatra / padrino

怎甘沉沦 提交于 2019-12-03 21:57:38
I've this and it works get :about, :map => '/about_us' do render :erb, "<%= 'foo' %>" end get '/:slug' do redirect "/about_us" # <-- end Is possible to do in some way "render" instead of "redirect"? or something like render 'posts/1' get :about, :map => '/about_us' do render :erb, "<%= 'foo' %>" end get '/:slug' do call env.merge('PATH_INFO' => '/about_us') end 来源: https://stackoverflow.com/questions/3384134/alias-url-with-sinatra-padrino

Slim3 exclude route from CSRF Middleware

南笙酒味 提交于 2019-12-03 21:49:41
I'm building a webshop based on the slim3 framework. I need to handle a server-to-server POST-request to confirm if payment was successful. I added csrf to the container like this: $container['csrf'] = function($container) { return new \Slim\Csrf\Guard; }; and added it to the app like this: $app->add($container->csrf); And it works good. But now i need to be able to add an exception to a certain route so i get the post reques they are sending. I'couldn't find a working solution so far. Any advice? If you need to exclude one route from a middleware, there are two options: Option 1: group your

getting a 'name' based URL in RESTful routes instead of an id based url

99封情书 提交于 2019-12-03 21:47:06
If I implement RESTful routing for a controller 'galleries' like as follows: map.resources :galleries By default the show url for this controller would be: /galleries/:id which would respond to any requests to /galleries/1 etc. What if I had a gallery record in the database with a 'name' attribute with value 'portraits'. Could I do the same as follows: /galleries/portraits instead of doing /galleries/1 ? In your Gallery model, add a #to_param method that returns what you want in the URL (in this case, name ). In your controller, you still access the value through params[:id] and you'll

Outputcache doesn't work with routing

冷暖自知 提交于 2019-12-03 21:44:37
I'm using routing from System.Web.Routing without MVC in a standard ASP.Net Web Application Project application. This is mostly done to get neater urls in the portal we are developing (instead of ~/default.aspx?contentid=123 we have ~/{contentsubject}. The portal is not authorized and all info is in the url so in a caching scenario we can cache complete pages. When I tried to enable output caching I noticed that no caching was done. It seems that the outputcache page directive is completely ignored. Is this true or am I missing something? Can this be fixed? I made a small test app (I uploaded

Why does .htaccess redirect URL routing fine but break css/js/image links after two levels deep?

家住魔仙堡 提交于 2019-12-03 21:38:31
I have the following .htaccess file in a subdirectory of a site: RewriteEngine On RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?params=$1 [L,QSA] I have the following index.php file: <html> <head> <link href="css/main.css" rel="stylesheet"/> <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="js/main.js"></script> </head> <body> <p>if css loads, this should be green</p> <p id="message">javascript is NOT loaded</p> <div>If images are

How to set baseUrl in Polymer Starter Kit?

ε祈祈猫儿з 提交于 2019-12-03 21:33:27
How to set baseUrl in Polymer Starter Kit(light version)? (similar: Serving Polymer App to a /path not at root ) I want to run it in subfolder (dl and unzipped PSK there, server is xampp): http://localhost/test/psk/app/ When I go to that URL, app is redirecting to: http://localhost/ with this note: Can't find: http://localhost/test/psk/app/#!/test/psk/app/ . Redirected you to Home Page Ok There are no console errors, app work fine except the URL problem. Here are app.js : // Sets app default base URL app.baseUrl = '/'; if (window.location.port === '') { // if production // Uncomment app