url-routing

WebForms custom / dynamic routing

萝らか妹 提交于 2019-12-01 01:58:58
I'm using Phil Haack's URL routing for WebForms and I would like to define a route that's "dynamic." Let's say I have this route: "{any}.aspx" -- goes to --> "~/PageProcessor.aspx" This would take any request that's not a physical page to the PageProcessor page. This works great. The problem is that, based on some data that comes from a database, I need certain pages to be routed to a different processor, let's say DifferentPageProcessor.aspx. I can't define a new route that catches all the .aspx files because the first one catches everything. So, I would need a way to process the request

How to do MVC form url formatting?

一笑奈何 提交于 2019-12-01 00:33:54
I am using PHP. I want to create an MVC setup from scratch to learn more about how MVC works. I want to use clean urls with slashes as delimiters for the arguments. How do people do this when it comes to GET method forms? Or do people avoid GET method forms all together? As of right now the ways I can imagine are: Don't use GET method forms (although this makes it harder to let users bookmark/link in some cases). Use AJAX instead of form submission (although what do you do for SEO and JS disablers?). Have page submit to itself with post method, then reform the post vars into an url, then

codeigniter default controller url routing

假如想象 提交于 2019-12-01 00:19:27
I am putting together a simple networking site and would like to have the urls work similar to facebook so by typing in domain.com/username I would get a user profile. I can do this already this way Logged in users profile at domain.com/ other users profile at domain.com/home/username The default controller is called home and I am currently using the _remap function to check for extra url parameters to display different data based on what is or isn't passed. My question is how would I map this out so I can access user profiles by: domain.com/username Is there a routes.php setting I could use?

WebForms custom / dynamic routing

故事扮演 提交于 2019-11-30 20:56:34
问题 I'm using Phil Haack's URL routing for WebForms and I would like to define a route that's "dynamic." Let's say I have this route: "{any}.aspx" -- goes to --> "~/PageProcessor.aspx" This would take any request that's not a physical page to the PageProcessor page. This works great. The problem is that, based on some data that comes from a database, I need certain pages to be routed to a different processor, let's say DifferentPageProcessor.aspx. I can't define a new route that catches all the

How to make my URL mapping case insensitive?

天涯浪子 提交于 2019-11-30 20:26:52
Grails, by default, is case-sensitive when mapping URL to controller actions or views. For instance, www.mywebsite.com/book/list will work BUT www.mywebsite.com/Book/list will return a 404 page. What can I do (code snippets are welcomed) to make my URL case-insensitive (i.e. www.mywebsite.com/Book/list being a valid url) ? Just a shoot from the hip, try the following: static mappings = { "/$controller/$action?/$id?"{ controller = controller.toLowerCase() action = action.toLowerCase() } Controller is a "reserved keyword" you have to rename it to something like "controllerName" static mappings =

AngularJS Restful Routing

浪子不回头ぞ 提交于 2019-11-30 20:07:13
I'm trying to structure my app using the Restful/Ruby convension /<resource>/[method]/[id] . How I've done it previously when using a server-side MVC framework like CodeIgniter was to dynamically route based on the URI: ex. www.foo.com/bar/baz/1 The app would then use method baz in controller/class bar and return views/bar/baz.php (populated with data from bar->baz ) I would like to do the same in Angular, but I'm not sure if it supports this (and if it does, I'm not sure exactly how to go about it). At the moment I'm using $routeProvider 's when method to specify each case. $location.path()

How to do MVC form url formatting?

末鹿安然 提交于 2019-11-30 19:00:23
问题 I am using PHP. I want to create an MVC setup from scratch to learn more about how MVC works. I want to use clean urls with slashes as delimiters for the arguments. How do people do this when it comes to GET method forms? Or do people avoid GET method forms all together? As of right now the ways I can imagine are: Don't use GET method forms (although this makes it harder to let users bookmark/link in some cases). Use AJAX instead of form submission (although what do you do for SEO and JS

Switching to {controller}/{id}/{action} breaks RedirectToAction

孤街浪徒 提交于 2019-11-30 19:00:18
I am trying to use proper REST urls with MVC . To do that I switched default Routing from: {controller}/{action}/{id} to {controller}/{id}/{action} so instead of: /Customer/Approve/23 there is now /Customer/23/Approve ActionLink seems to work ok, but the following code in CustomerController: [CustomAuthorize] [HttpGet] public ActionResult Approve(int id) { _customerService.Approve(id); return RedirectToAction("Search"); //Goes to bad url } ends up on url /Customer/23/Search . While it should be going to /Customer/Search . Somehow it remembers 23 (id) . Here is my routing code in global.cs

ASP.NET MVC to ignore “.html” at the end of all url

左心房为你撑大大i 提交于 2019-11-30 18:29:34
I am new to asp.net mvc and now struggling with url routing. I'm using asp.net mvc 3 RC2. How can I create a url routing that IGNORES the very end extension in url. the extension can be: .html , .aspx , .php , .anything . For example, these urls: /Home.html /Home.en /Home.fr /Home should go to Home controller? one more example: /Home/About.html /Home/About.en /Home/About.fr /Home/About should go to Home controller and About action. thank you :) I'm not sure if you're using IIS7, but if so, then I would recommend a rewrite rule which checks for urls ending in .xyz and then doing a rewrites for

httprouter configuring NotFound

送分小仙女□ 提交于 2019-11-30 18:12:42
问题 I'm using httprouter for an API and I'm trying to work out how to handle 404s. It does say in the docs that 404's can be handled manually but I don't really have an idea how to write my own custom handler . I've tried the following after my other routes... router.NotFound(pageNotFound) But I get the error not enough arguments in call to router.NotFound . If anyone could point me in the right direction it would be great. 回答1: The type httprouter.Router is a struct which has a field: NotFound