url-routing

Understanding routing in Global.asax (asp.net-mvc)

陌路散爱 提交于 2019-12-09 05:24:53
问题 In Global.asax what does the following signify? routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 回答1: This is one of the really frustrating things about learning MVC - the documentation for this feature is awful - there's just hardly anything there: http://msdn.microsoft.com/en-us/library/dd470170(VS.100).aspx. routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); This allows all the something.axd files to run outside of MVC - that "{*pathInfo}" at the end allows query strings to be ignored (it

How do I get Route name from RouteData?

扶醉桌前 提交于 2019-12-09 04:28:54
问题 I have several routes defined in my Global.asax; When I'm on a page I need to figure out what is the route name of the current route, because route name drives my site menu. How can this be done? 回答1: Unfortunately, it's not possible to get the route name of the route because the name is not a property of the Route. When adding routes to the RouteTable, the name is used as an internal index for the route and it's never exposed. There's one way to do this. When you register a route, set a

ASP.NET MVC URL Routing with Multiple Route Values

狂风中的少年 提交于 2019-12-08 22:38:43
问题 I am having trouble with Html.ActionLink when I have a route that takes more than one parameter. For example, given the following routes defined in my Global.asax file: routes.MapRoute( "Default", // Route name "{controller}.mvc/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); routes.MapRoute( "Tagging", "{controller}.mvc/{action}/{tags}", new { controller = "Products", action = "Index", tags = "" } ); routes.MapRoute(

Backbone navigate triggers twice in Firefox

瘦欲@ 提交于 2019-12-08 19:14:04
问题 Trying to use Backbone's navigate property. this.navigate("week/" + companyName + "/" + employeeNo + "/" + weekEnd, { trigger: true, replace: false }); The code above is executed once. It hits this: routes: { "week/:companyName/:employeeNo/:weekEnd": "getWeek" }, And then this function gets hit twice: getWeek: function (companyName, employeeNo, weekEnd) { console.log('getWeek:', companyName, employeeNo, weekEnd); } It is logged twice in Firefox, only once in IE and Chrome. What's the issue

Routing vs Url Rewrite (IIS7) Performance

强颜欢笑 提交于 2019-12-08 18:06:20
问题 I was wondering is there any difference in terms of performance between the two approaches? Any good articles on this? 回答1: Lets think about the difference in what's actually happening: URL rewriting: IIS receives request and passes it to unmanaged module Module matches the request against a set of patterns and returns a transformation IIS passes the returned transformation to the ASP.NET module and starts request lifecycle Routing: IIS receives request and passes it to ASP.NET ASP.NET

Laravel 4 - Get Current Route Name on Hidden Input to use for search

旧巷老猫 提交于 2019-12-08 15:00:50
问题 I have a search form in the nav bar on my Laravel 4 app. When someone types into search and submits I want the queries to only be performed based on what section of the site they are on. Example, if they are on the blog page, I want it to return only blog posts, and if they are on the users page, I want it to only bring up a list of users. Unless I'm missing something (certainly possibly as I'm new to Laravel!) I can do this using getCurrentRoute()->getPath(). But I have to do this from the

Polymer back button doesn't work with hash routing

爷,独闯天下 提交于 2019-12-08 14:50:33
问题 Sup! Back button sometimes doesn't work with my polymer project. When i hit back button the page variable is steel the current page and i need to hit the button twice or three times to get it working for example i go to the /#/rules page from /#/home but it doesn't go back to /#/home once i press the back button the second or third time by the way it does go back to the main page. Here is my observer and router: properties: { page: { type: String, reflectToAttribute: true, observer: '

Extensionless SEO Friendly with Asp.net webforms

旧街凉风 提交于 2019-12-08 12:23:22
问题 How to get extension less and without query string SEO friendly URL for asp.net web forms.? 回答1: I have found out a very good article Here It is a very good blog post written on how to redirect urls which contain query strings as extension less seo friendly urls. One method of doing it by including Global.asax into the application. Here is the example. Include Global.asax into the application. <%@ Import Namespace="System.Web.Routing" %> inside global.asax file void registerroute

Change route to username after registration

这一生的挚爱 提交于 2019-12-08 10:26:32
问题 I have followed the correct answer marked for this thread How to change route to username after logged in? and my requirement is exactly what the question says. However when I register a new user (I am using username instead of email) the redirection doesn't follow my custom route. For instance, when I register with username = Janet, the URL looks like localhost/?username=Janet and throws an error. But if I manually remove the "/?username=" and keep localhost/Janet then it shows the landing

Routing issue with Slim framework

给你一囗甜甜゛ 提交于 2019-12-08 08:57:29
问题 I just got started with Slim. My application for the moment is something like this: <?php require 'vendor/autoload.php'; $app = new \Slim\Slim([ 'debug' => true ]); var_dump($app->request()); $app->get('/:name', function ($name) { echo "Hello, $name"; }); $app->get('/', function () { echo 'hello world'; }); $app->run(); I am running it on localhost using PHP built in web server. For every request I try in the browser (or Postman, or CURL), what I get is always "hello world", as if the first