url-routing

How to make ASP.NET Routing escape route values?

风流意气都作罢 提交于 2019-11-27 07:50:50
问题 I have an ASP.NET MVC site where I want routes like /{controller}/{id}/{action}/{date} , where "date" is the mm/dd/yyyy portion of a date/time. (I'm dealing with time-dimensioned data, so I need both an ID and a point in time to do most operations) The route for this is simple: routes.MapRoute( "TimeDimensionedRoute", "{controller}/{id}/{action}/{date}", new { controller = "Iteration", action = "Index", id = String.Empty, date = String.Empty } ); This route correctly maps " /Foo/100/Edit/01

How to ignore route in asp.net forms url routing

核能气质少年 提交于 2019-11-27 07:27:27
I am using the .NET 3.5 SP1 framework and I've implemented URL routing in my application. I was getting javascript errors: Error: ASP.NET Ajax client-side framework failed to load. Resource interpreted as script but transferred with MIME type text/html. ReferenceError: Can't find variable: Sys Which I believe is because my routing is picking up the microsoft axd files and not properly sending down the javascript. I did some research and found that I could use Routes.IgnoreRoute , which should allow me to ignore the axd like below: Routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); But, when I

URIs with german special characters don't work (error 404) in Zend Framework 2

跟風遠走 提交于 2019-11-27 07:22:18
问题 I want to get a list of cities, where each city name is linked and refers a page for this city: The links (created in the view script) look like this: http://project.loc/catalog/Berlin (in the HTML source code url-encoded: Berlin) http://project.loc/catalog/Erlangen (in the HTML source code url-encoded: Erlangen) http://project.loc/catalog/Nürnberg (in the HTML source code url-encoded: N%C3%BCrnberg) "Berlin", "Erlangen" etc. work, but if the city name contains a german special character ( ä

Changing the base URL for Rails 3 development

拈花ヽ惹草 提交于 2019-11-27 07:08:33
I know I'm going to deploy to an environment with my application running with a base URL which looks like this: http://someserver/mydepartment/myapp My development environment is set up to use the default Rails configuration, which looks like this: http://localhost:3000/myapp I'd like to model this deployment path in my development environment. That is, I'd like to develop with a base URL which looks like this: http://localhost:3000/mydepartment/myapp That way, I can make all my URLs relative to "/" and they will work in both environments. How can I change it so my application will live at

AngularJS application config “Uncaught object” error (ngRoute)

ぃ、小莉子 提交于 2019-11-27 06:51:37
问题 I have this simple page: <!doctype html> <html> <head > <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href='bower_components/bootstrap/dist/css/bootstrap.css')> <script src='bower_components/jquery/dist/jquery.min.js'></script> <script src='bower_components/angular/angular.js'></script> <script src='bower_components/bootstrap/dist/js/bootstrap.min.js'></script> <script src='js

ASP.net MVC support for URL's with hyphens

谁都会走 提交于 2019-11-27 06:37:57
Is there an easy way to get the MvcRouteHandler to convert all hyphens in the action and controller sections of an incoming URL to underscores as hyphens are not supported in method or class names. This would be so that I could support such structures as sample.com/test-page/edit-details mapping to Action edit_details and Controller test_pagecontroller while continuing to use MapRoute method. I understand I can specify an action name attribute and support hyphens in controller names which out manually adding routes to achieve this however I am looking for an automated way so save errors when

Rails: redirect all unknown routes to root_url

五迷三道 提交于 2019-11-27 06:30:18
Whenever a user hits the wrong page, rails shows 404.html from the public folder. However, I'd like just to redirect the browser to the root page, without showing anything. So I tried globbing, but came to no avail, it still shows the 404 page. Here's an extract from my routes file: # ... map.root :controller => 'home', :action => 'home' map.connect '*', :controller => 'home', :action => 'home' Any suggestions? Thanks, guys! Arkan If your project is powered by rails 3, add simply this line to your routes.rb match '*path' => redirect('/') Edit: If you're on Rails 4 or 5 match '*path' =>

ASP.NET URL Rewriting

怎甘沉沦 提交于 2019-11-27 03:56:39
How do I rewrite URL's in ASP.NET? I would like users to be able to goto http://www.website.com/users/smith instead of http://www.website.com/?user=smith Try the Managed Fusion Url Rewriter and Reverse Proxy: http://urlrewriter.codeplex.com The rule for rewriting this would be: # clean up old rules and forward to new URL RewriteRule ^/?user=(.*) /users/$1 [NC,R=301] # rewrite the rule internally RewriteRule ^/users/(.*) /?user=$1 [NC,L] Microsoft now ships an official URL Rewriting Module for IIS: http://www.iis.net/download/urlrewrite It supports most types of rewriting including setting

Web.config: Wildcards in location and authorization

不羁岁月 提交于 2019-11-27 02:42:40
问题 In my ASP.Net application I'm using URL routing. The url format is somewhat like: http://site/{culture}/project/{id} . To allow users to visit the login and recovery page, I've added the following entries to my web.config: <location path="en-GB/login"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="nl-NL/login"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="login"> <system

$state transition after rejected promise Angular ui-router

我的未来我决定 提交于 2019-11-27 02:09:16
问题 I'm using Angular ui-router and have a resolve function set up for one of my states, before the controller is initialized. I retrieve some data, loop through and match it up the URL stateParam, and if a match is found, resolve the promise to the controller and return that object in the promise. That's all working well. However, if a match isn't found I simply want to redirect to a different state by rejecting the promise and running $state.go('state'); Simply this: deferred.reject(); $state