url-routing

MVC Routing Parameter Precedence

守給你的承諾、 提交于 2019-11-26 19:12:32
I came across a scenario where I had the default MVC Route setup. Like So. routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); Then navigating to a url as such domain/controller/action/1234 On this page I was then navigating to the same page but with different parameters after a certain event. Like so. var id = $(this).data("id"); var url = "@Url.Action("action", "controller", new { area = ""})"; var params = $.param({id: id, vrnsearch: true}); var fullUrl = url += "?" + params; window

AngularJS - Animate ng-view transitions

瘦欲@ 提交于 2019-11-26 18:53:50
问题 I have 2 html pages, welcome.html and login.html both of which are "inserted" into index.html dependending on the URL via an ngview attribute and router provider , as part of my AngularJS app. An example of this can be found on the AngularJS home page under Wire up a Backend . My question : Is there a way to animate the transition between welcome.html and login.html ? 回答1: Angularjs 1.1.4 has now introduced the ng-animate directive to help animating different elements, in particular ng-view.

ASP.NET MVC Url Route supporting (dot)

倾然丶 夕夏残阳落幕 提交于 2019-11-26 18:44:49
I hope that you can help me with the below problem. I am using ASP.NET MVC 3 on IIS7 and would like my application to support username's with dots. Example: http://localhost/john.lee This is how my Global.asax looks like: ( http://localhost/ {username}) routes.MapRoute( "UserList", "{username}", new { controller = "Home", action = "ListAll" } ); The applications works when I access other pages such as http://localhost/john.lee/details etc. But the main user page doesn't work, I would like the app to work like Facebook where http://www.facebook.com/john.lee is supported. I used below code and

How to create app-wide slug routing for Rails app?

拟墨画扇 提交于 2019-11-26 18:25:16
问题 I have a number of different models in the Rails app I'm working on. I've seen a number of sites use an app-wide slug routing approach. What do I mean by this? http://example.com/nick-oneill <-- This points to a User object http://example.com/facebook <-- This points to a Company object http://example.com/developers <-- This points to the users#index page I'm aware of to_param and creating reader-friendly slugs within apps, however I'm not aware of an approach to have root-level slugs for a

ASP.NET MVC custom routing for search

时光总嘲笑我的痴心妄想 提交于 2019-11-26 18:15:52
Here is my scenario. For the example lets say that I need to return a list of cars based on a search criteria. I would like to have a single View to display the results since the output will be the same, but I need several ways of getting there. For instance, I may have a Form with a textbox to search by year. I may have another separate page that contains a hyperlink for all red, Toyota cars. How do I handle these multiple scenarios in the same View and Controller. My dilemma is that the search could contain several options… year, make, model, etc but I don’t know where to put them. What is

AngularJS: can't get html5 mode urls with ui-route $state

孤街浪徒 提交于 2019-11-26 18:10:57
问题 I'm using ui-router for state management but I think I'm having trouble with my .htaccess rewrite rules. All my states worked when using /#/account style urls. Now I've enabled html5 mode but my app isn't rendering as it was before. It seems to load my index.html and all my js and css files, etc. but not actually initialise any states. Here is my folder structure: root/ app/ components/ angular/ ... images/ scripts/ controllers/ directives/ ... app.js styles/ views/ .htaccess ... My vhosts

url with multiple forward slashes, does it break anything?

狂风中的少年 提交于 2019-11-26 17:55:13
http://example.com/something/somewhere//somehow/script.js Does the double slash break anything on the server side? I have a script that parses URLs and i was wondering if it would break anything (or change the path) if i replaced multiple slashes with a single slash. Especially on the server side, some frameworks like CodeIgniter and Joomla use segmented url schemes and routing. I would just want to know if it breaks anything. HTTP RFC 2396 defines path separator to be single slash . However, unless you're using some kind of URL rewriting (in which case the rewriting rules may be affected by

Route with Two optional parameters in MVC3 not working

心已入冬 提交于 2019-11-26 17:49:17
问题 I have a following types of url used in my Application. localhost/admin/userdetail/id localhost/admin/userdetail/id/true localhost/admin/userdetail/id/true/success Here is my Admin Controller bool inSaveAction, string status are optional [Authorize] public ActionResult UserDetail(string Id, bool inSaveAction, string status) { } [HttpPost, Authorize, ValidateAntiForgeryToken] public ActionResult SaveUserDetail(UserDetailViewModel viewModel) { User userToSave = new User(); AdminService

Can I create routes with react-router for a github-pages site?

可紊 提交于 2019-11-26 17:19:02
问题 Ok, so I've made a SPA using React and React-Router and have pushed it to github pages, but none of the routes I have written work when I refresh or click back in my browser. I had the same problem when I was serving the page locally, but then followed along to this SO answer and made a server.js file which provided a redirect to my static HTML page at each route. Here is what the file looks like: "use strict"; let express = require('express'); let path = require('path'); let app = express();

Routing URLs in PHP

允我心安 提交于 2019-11-26 17:07:17
问题 I'm working on a web page project. I decided to use Apache, PHP (5.1.7, version imposed by my service provider) and Dwoo (templating) for this purpose. I want to route URLs to my templates. I'm aware there are many frameworks doing this kind of thing. I'm just wondering if there's a nice way to achieve it without. I've set up my project as follows: src/dwoo - Dwoo files index.php - This should handle routing. Currently it just renders the front page of the site using a template. templates -