routing

Asp.Net: Removing the action name from the URL

爱⌒轻易说出口 提交于 2019-12-02 07:21:31
问题 I am trying to create a routing rule that allows me to use http://localhost:*****/Profile/2 instead of http://localhost:*****/Profile/Show/2 to access a page. I currently have a routing rule that successfully removes index when accessing a page. How do I apply the same concept to this? routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); 回答1: I have a couple of questions to clarify what you

Angular: take user to home on clicking browser back button [duplicate]

久未见 提交于 2019-12-02 07:21:26
问题 This question already has answers here : History push state redirects instead of just pushing new state to browser history (2 answers) Closed 8 months ago . I want to take the user to the home page when a user clicks on the back button of the browser if the user is in my angular platform. There is an edge case as well which is to be handled, if user has come to our platform via google search, Fb or direct entering link, then we cant this behavior but if he ia already roaming around in our

Route a form to new controller action in Ruby on Rails

人走茶凉 提交于 2019-12-02 06:37:35
问题 I am relatively new to Ruby on Rails, and am trying to set up a form with a new action on an existing controller. My existing model and controller is called 'projects', and I created a new action in the controller called 'queue'. The goal is that a user can filter projects by different users using '/queue/username'. routes.rb match 'queue/:username' => 'projects#queue' projects_controller.rb def queue if (params[:user_id].blank? && params[:user_id].nil?) @projects = Project.find_all_by_user

matching URL parameter spanning multiple “/” in ASP.NET MVC

≡放荡痞女 提交于 2019-12-02 06:04:33
What is the best way to match URL parameter spanning multiple "/" in ASP.NET MVC ? Eg URL: http://example.com/controller/action/p1/p2/p3/p4 I want to pass just one parameter to the action method (above, it is "p1/p2/p3/p4"). Here, the parameter may have arbitrary number of subitems ( p1/.../pn ). What is the best way to accomplish this? Any way to get this implemented using pure MVC routing? If i understand it clearly you want to make it this way routes.MapRoute(null, "{controller}/{action}/{*p}", new { controller = "Home", action = "Index" }); public class HomeController : Controller { public

Setting index route in Symfony 2

廉价感情. 提交于 2019-12-02 05:53:56
问题 I've got Symfony2 installed, and a mostly working site, the only issue is I don't know how to set a default route. Currently, I access my index and other routes with the following URLs: www.example.com/app_dev.php/index www.example.com/app_dev.php/example_route I'd like to have www.example.com default to the index route, so I can get the same results with the following URLs: www.example.com www.example.com/example_route I'm running lighttpd as my web server. How can I configure lighttpd

Rails 3 - Nested Resources Routing - One to One relationship

╄→尐↘猪︶ㄣ 提交于 2019-12-02 05:36:29
问题 Having some trouble with some nested resources routing. What I'm trying to do is link to a user's profile page for editing purposes. In my view it is written as: <%= link_to "Edit Profile", edit_user_profile_path(current_user) %> Which errors out with: No route matches {:action=>"edit", :controller=>"profiles", :user_id=>#<User id: 1, email: "EDITEDOUT", hashed_password: "EDITEDOUT", created_at: "2011-01-20 18:30:44", updated_at: "2011-01-20 18:30:44">} In my routes.rb file, it looks like so:

Easiest way to map route in PHP

情到浓时终转凉″ 提交于 2019-12-02 05:33:43
问题 I was browsing Symfony's website. I didn't really feel like I need all the functionality the framework offers, but I did like the routing part. It allows you to specify URL pattern like this /some/path/{info} Now for URL like www.somewebsite.com/app.php/some/path/ANYTHING it would allow you to send client a response specific for this URL. You could also use string ANYTHING and use it similar as GET parameter. There is also option to hide app.php part of the URL which leaves us URL like www

Can i hide controller and view name cake php 2?

爷,独闯天下 提交于 2019-12-02 05:30:38
I am using cake php and due to some reason i want to hide controller and action name from the url . current url us like http://192.168.1.31/home/this_is_test where home is controller name and this_is_test is slug which is dynamic . i want the url like http://192.168.1.31/this_is_test . my routes.php is Router::connect('/', array('controller' => 'home', 'action' => 'index')); Router::connect('/dashboard', array('controller' => 'dashboard', 'action' => 'index')); Router::connect('/login', array('controller' => 'users', 'action' => 'login')); Router::connect('/admin/login', array('controller' =>

MVC Route Map Got Exception on Html.RenderAction : No route in the route table matches the supplied values

六眼飞鱼酱① 提交于 2019-12-02 05:13:05
I use ASP.NET MVC 5 and this is My Route Map for all of the actions except Home/index : routes.MapRoute( name: "randomNumber", url: "{controller}/{randomNumber}/{action}", defaults: new { }, constraints: new { randomNumber = @"\d+" } ); And for first page: Home/Index I don't want to use {randomNumber} So the first solution I think is: routes.MapRoute( name: "Default", url: "{controller}/{action}", defaults: new { controller = "Home", action = "Index" } ); This route map solve my problem, but caused another problem that is: clients can access to other actions without {randomNumber} , but I just

Why do I keep getting a routing error when visiting a users page in my Ruby on Rails application?

不想你离开。 提交于 2019-12-02 04:56:50
I am trying to add comments to the microposts found in https://github.com/railstutorial/sample_app_2nd_ed from the michael hartl railstutorial. It seems that if a user has made no microposts, there is no problem and I can access their page. However if they have there is a routing error. This is my problem. Here is the area in question on my routes.rb file. resources :microposts, only: [:create, :destroy] do resources :comments, end This is the error I get when I try to visit a users page (localhost:3000/users/2): Started GET "/users/2" for 127.0.0.1 at 2012-05-21 21:32:47 -0700 Processing by