routing

Aurelia: child router routes display in “main” nav-bar and child view in app.html <router-view> element?

ぐ巨炮叔叔 提交于 2019-12-09 13:16:20
问题 We want to have a sidebar menu and a "main" area. Depending on how you navigate, the sidebar's menu items will change, and a new view will be loaded into the "main" area. I've created app.html with a <router-view> element, and a nav-bar.html that can display the main router's navigation. Let's say that I initially have "Administration" and "Reports" as routes (and therefore menu items). When a user clicks on "Administration", I'd like the menu to update to display child routes (say "Users"

Default route not working

橙三吉。 提交于 2019-12-09 13:03:22
问题 Why doesn't this work? Route: routes.MapRoute( "Summary", "{controller}/{id}", new { controller = "Summary", action = "Default" } ); Controller: public class SummaryController : Controller { public ActionResult Default(int id) { Summary summary = GetSummaryById(id); return View("Summary", summary); } } URL: http://localhost:40353/Summary/107 Error: Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies

Asp.Net MVC Routing - how do I match the whole URL?

旧巷老猫 提交于 2019-12-09 12:57:16
问题 I'm trying to create a catch-all route to track when an affiliate string is in the URL. An affilite code is marked by an x followed by an int , and will only appear at the end of a URL (but before the query string). The idea is that I will extract the affiliate ID, do some logging, then do a 301 to the same request without the affiliate ID. For example: http://www.domain.com/x32 http://www.domain.com/x32/ http://www.domain.com/path/to/something/x32 http://www.domain.com/x32?query=string http:

Remove Trailing Slash in ASP.NET MVC 4 Route to Application Root

岁酱吖の 提交于 2019-12-09 06:27:36
问题 In my ASP.NET MVC 4 application's RouteConfig file, I have registered the following default route: routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "home", action = "index", id = UrlParameter.Optional }); Now, in my Razor views, I want to generate a URL to my application's root like that: <a href="@Url.Action("index", "home")">Home</a> The generated URL includes a trailing slash; clicking the link thus opens the page localhost/IISApplicationName /. However, I want

Getting $_GET parameters from route in Zend Framework 2

帅比萌擦擦* 提交于 2019-12-09 06:12:33
问题 Zend Framework 1 had a very simple way of parsing URL routes and setting found params in the $_GET superglobal for easy access. Sure, you could use ->getParam($something) inside the controller, but if the param was found in the URL, it was also accessible via $_GET. Example for url mypage.com/mymodule/mycontroller/myaction/someparam/5: ZF1 $this->getParam('someparam'); // 5 $_GET['someparam']; // 5 ZF2 $this->getEvent()->getRouteMatch()->getParam('someparam'); // 5 $_GET['someparam'] //

Is a global variable defined inside a Sinatra route shared between requests?

落爺英雄遲暮 提交于 2019-12-09 04:50:25
问题 Say I've got: get '/' do $random = Random.rand() response.body = $random end If I have thousands of requests per second coming to /, will the $random be shared and 'leak' outside the context or will it act like a 'local' variable to the get block? I imagine if it was defined outside of the context of get '/' do it would indeed be shared but I wonder if there's a mechanic to $ in ruby that I'm not aware of. 回答1: This part of the Sinatra README about scope is always helpful to read but if you

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

RoutingError inside an iFrame

痴心易碎 提交于 2019-12-09 03:52:52
问题 I scaffolded a test app and got a Routing error when I put an iFrame inside my view: This is the show template where I added the iFrame: views/bars/show.html.erb: <p> <b>Body:</b> <%=h @bar.body %> </p> <iframe src=“http://www.yahoo.com” style=“width:500px; height:500px;” frameborder=“0?></iframe> <%= link_to 'Edit', edit_bar_path(@bar) %> | <%= link_to 'Back', bars_path %> I'm calling the page like this: http://localhost:3000/bars/1 The page displays correctly. But the iFrame inside the page

Routing Classic ASP Requests To .NET - SEO Redirects

有些话、适合烂在心里 提交于 2019-12-09 01:02:01
问题 We are replacing an old classic asp website with a .NET 3.5 solution. We need to redirect all of the classic ASP requests to aspx pages (i.e. contactus.asp, may now route to /contact-us/default.aspx). What I woudl like is for the requests to hit global.asax so I can do something like If url == "bob.asp" Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", SiteConfig.SiteURL + redirectUrl); End If There are two inelegant solutions. A) Place a global.asa file and do the

Website asks for “Authentication Required” on an MVC controller, but not others

懵懂的女人 提交于 2019-12-08 19:44:14
问题 I have an asp.net C# MVC website. It uses SimpleAuthentication and forms authentication. Everything works fine, requiring people to log in to go to pages. However, I have one controller called "ReportsController". Whenever you go to the URL's of the actions within this controller it always pops up with "Authentication Required" in the browser window. It is only doing it for this controller and not any others. The URL will be "www.domain.com/reports". This URL works fine when I run from IIS