routing

How do I configure ASP.NET MVC routing to hide the controller name on a “home” page?

杀马特。学长 韩版系。学妹 提交于 2019-12-17 07:34:27
问题 Following on from this question: ASP.NET MVC Routing with Default Controller I have a similar requirement where my end user doesn't want to see the controller name in the url for the landing or "home page" for their application. I have a controller called DeviceController which I want to be the "home page" controller. This controller has a number of actions and I'd like to use URL's like the following: http://example.com -> calls Index() http://example.com/showdevice/1234 -> calls ShowDevice

Rails Routes - Limiting the available formats for a resource

♀尐吖头ヾ 提交于 2019-12-17 07:30:53
问题 I have a series of resources that I want only available if accessed via the JS format. Rails' route resources gives me the formats plus the standard HTML. Is there a way to specify that only the JS format routes be created? 回答1: You just add constraints about format : resources :photos, :constraints => {:format => /(js|json)/} 回答2: You must wrap those routes in a scope. Constraints unfortunately don't work as expected in this case. This is an example of such a block... scope :format => true,

Symfony2 Routing - route subdomains

戏子无情 提交于 2019-12-17 07:06:17
问题 Is there a way to set up hostname based routing in Symfony2 ? I didn't find anything about this topic in the official documentation. http://symfony.com/doc/2.0/book/routing.html I want to route the request based on the given hostname: foo.example.com bar.example.com {{subdomain}}.example.com So in essence, the controller would get the current subdomain passed as a parameter. Similar to the Zend solution: http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router

Angular2 How to navigate to certain section of the page identified with an id attribute

不羁的心 提交于 2019-12-17 06:53:11
问题 How to navigate to certain section of the page identified with an id attribute? Example: I need to navigate to "structure" paragraph on my page <div id="info"> <h3>Info</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> </div> <div id="structure"> <h3>Structure</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> </div> And I have a following navigation structure: <li> <ul materialize="collapsible" class="collapsible" data-collapsible="accordion"> <li><a

Angular ng-view/routing not working in PhoneGap

大城市里の小女人 提交于 2019-12-17 04:47:11
问题 I'm having a problem with ngView in PhoneGap. Everything seems to be loading just fine and I can even get a basic controller working using ng-controller. But when I try to use routing with ngView, nothing happens. index.html <!doctype html> <html ng-app> <head> <script type="text/javascript" src="lib/cordova-2.4.0.js"></script> <script type="text/javascript" src="lib/angular-1.0.4.min.js"></script> <script type="text/javascript" src="js/app.js"></script> </head> <body> <a href="#/test">Test<

IIS URL Rewriting vs URL Routing

让人想犯罪 __ 提交于 2019-12-17 04:16:12
问题 I was planning to use url routing for a Web Forms application. But, after reading some posts, I am not sure if it is an easy approach. Is it better to use the URL Rewrite module for web forms? But, it is only for IIS7. Initially, there was some buzz that URL routing is totally decoupled from Asp.Net MVC and it could be used for web forms. Would love to hear any suggestions.. 回答1: There's a great post here about the differences between the two from a member of the IIS team. One caveat I would

“The resource cannot be found.” error when there is a “dot” at the end of the url

我们两清 提交于 2019-12-17 02:36:08
问题 I'm using ASP .NET MVC Beta and I get the HTTP 404 (The resource cannot be found) error when I use this url which has a "dot" at the end: http://localhost:81/Title/Edit/Code1. If I remove the dot at the end or the dot is somewhere in the middle I don't get the error. I tried to debug but it I get the error from "System.Web.CachedPathData.GetConfigPathData(String configPath)" before ProcessRequest in MvcHandler. Is "dot" not allowed at the end of a url? Or is there a way to fix the route

laravel throwing MethodNotAllowedHttpException

怎甘沉沦 提交于 2019-12-17 02:11:19
问题 I am trying to get something very basic running. I am used to CI and now learning Laravel 4, and their docs are not making it easy! Anyways, I am trying to create a login form and just make sure that data is posted successfully by printing it in the next form. I am getting this exception: Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException and my MemberController.php: public function index() { if (Session::has('userToken')) { /*Retrieve data of user from DB using

Angular2 Routing with Hashtag to page anchor

孤人 提交于 2019-12-16 22:11:13
问题 I wish to add some links on my Angular2 page, that when click, will jump to specific positions within that page, like what normal hashtags do. So the links would be something like /users/123#userInfo /users/123#userPhoto /users/123#userLikes etc. I don't think I need HashLocationStrategy, as I'm fine with the normal Angular2 way, but if I add directly, the link would actually jump to the root, not somewhere on the same page. Any direction is appreciated, thanks. 回答1: Update This is now

Send data through routing paths in Angular

一笑奈何 提交于 2019-12-16 20:05:10
问题 Is there anyway to send data as parameter with router.navigate? I mean, something like this example, as you can see the route has a data parameter, but doing this it's not working: this.router.navigate(["heroes"], {some-data: "othrData"}) because some-data is not a valid parameter. How can I do that? I don't want to send the parameter with queryParams. 回答1: There is a lot of confusion on this topic because there are so many different ways to do it. Here are the appropriate types used in the