routing

Cant figure out how to route my NON-MVC site from sitemap.xml to another .aspx page

二次信任 提交于 2019-11-30 18:04:10
问题 When searching google the only solutions for this come up for MVC websites. My asp.net 4.0 site is not MVC. I want requests for sitemap.xml to load another dynamic .aspx page so I can generate links for google on the fly. I have spent hours searching, please if you know where I can find the answer, let me know. I have tried using RouteTable.Routes.Add("SitemapRoute", new Route("sitemap.xml", new PageRouteHandler("~/sitemap.aspx"))) 回答1: Your code is correct, and should be placed in the

:except not working in before_filter in application controller. Routing problem?

帅比萌擦擦* 提交于 2019-11-30 17:48:55
I have a before_filter in my application controller to keep a user's session alive (and log them out if a time out has been reached). This should be called on every action except /sessions/new and /sessions/destroy which are routed as /login and /logout. The relevant parts of my application controller look like this; class ApplicationController < ActionController::Base before_filter :update_activity_time, :except => [:login, :logout] private def update_activity_time if current_user time_out = current_user.setting.remember_me ? 20160 : current_user.setting.user_timeout from_now = time_out

AngularJs Routing with parameters

我是研究僧i 提交于 2019-11-30 17:44:50
Can someone explain how I can route to a Url using parameters? E.g. id like to click on a product and open more info of the product by Id. My Routing so far ... angular.module('shop', ["customFilters", "cart", "ngRoute"]) .config(function ($routeProvider){ $routeProvider.when("/complete", { templateUrl: "../app/views/orderComplete.html" }); $routeProvider.when("/placeorder", { templateUrl: "../app/views/placeOrder.html" }); $routeProvider.when("/checkout", { templateUrl: "../app/views/checkoutSummary.html" }); $routeProvider.when("/products", { templateUrl: "../app/views/productList.html" });

Express.js: how to make app.get('/[:userId]i'..) in req.param?

扶醉桌前 提交于 2019-11-30 17:43:35
问题 I m using nodejs 0.8.21 and express 3.1.0 I need to read userId from url like http://mysite.com/39i . It means userId=39 . How to do? Thank you. Sample: app.get('/:userId_i', function(req, res) { }); app.param('userId', function(req, res, next, id){ }); 回答1: Assuming you have a numerical id followed by an i and you want the id coming back as just the numerical. app.get("/:id([0-9]+)i", function (req, res) {...}); This will match a numeric followed by an i and will give you just the numeric in

Is there a C/C++ API to the route information on Windows?

元气小坏坏 提交于 2019-11-30 17:35:36
问题 Is there a windows or cygwin C/C++ API to collect information provided by the route command on Windows? I'm specifically interested in the route metrics. Here's an example of what route outputs, the IPs have been changed to protect the innocent. $ route PRINT -4 =========================================================================== Interface List 11...64 31 50 3b ba 96 ......Broadcom NetXtreme Gigabit Ethernet 17...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1 18..

Using tilde in script tag src attribute

天涯浪子 提交于 2019-11-30 17:20:50
In my asp.net website using MasterPage and Routing I use a tilde in the href attribute of the link tag for the stylesheet in the head section of the MasterPage. Like this: <link href="~/Styles/Main.css" rel="stylesheet" type="text/css" /> Which works like a charm. Since the website uses routing the url will contain more and more / , yet the stylesheet's href remains valid because the tilde points to the root of the web application and the styles are used. I tried using the same technique for the src attribute of the script tags, but this doesn't seem to produce the expected result. I tried:

Laravel 4 Optional Route Parameter

我怕爱的太早我们不能终老 提交于 2019-11-30 17:08:20
问题 I would like to know how to add an optional route parameter for a controller method: Currently I have a route, shown below: Route::get('devices/{code}/{area}','HomeController@getDevices'); and a controller method: public function getDevices($code=NULL,$area) {...} My get request will look like: /devices/A/ABC It's working fine, but I want the {code} parameter to be optional so that I can get data in different ways: /devices//ABC or /devices/ABC I've tried the following, but all failed with

Using tilde in script tag src attribute

↘锁芯ラ 提交于 2019-11-30 16:36:57
问题 In my asp.net website using MasterPage and Routing I use a tilde in the href attribute of the link tag for the stylesheet in the head section of the MasterPage. Like this: <link href="~/Styles/Main.css" rel="stylesheet" type="text/css" /> Which works like a charm. Since the website uses routing the url will contain more and more / , yet the stylesheet's href remains valid because the tilde points to the root of the web application and the styles are used. I tried using the same technique for

Correct 404 message for a missing ASP.Net MVC controller

删除回忆录丶 提交于 2019-11-30 15:48:45
I have an MVC 2 application that should always give a 'nice' 404 page. However currently I get a low level .Net one: "Server Error in '/sitename' Application..." I have a base controller that has a NotFound action that will render the nice 404 page. Missing actions are handled: protected override void HandleUnknownAction(string actionName) { this.NotFound(actionName).ExecuteResult(this.ControllerContext); } So a visit to {site}/ValidController/NotAnAction gets routed correctly. However a visit to {site}/NotAController doesn't. I have routes set up with a catch all: routes.MapRoute( "MVC routes

How to route and render (dispatch) from a model in Ruby on Rails 3

瘦欲@ 提交于 2019-11-30 15:21:58
I want to dispatch (route and render) from a model. (I only care about GET requests and I ignore Accept: headers, so I only look at PATH_INFO .) # app/models/response.rb class Response < ActiveRecord::Base # col :path_info # col :app_version # col :body, :type => :text def set_body params = Rails.application.routes.recognize_path(path_info, :method => :get) controller = "#{params[:controller].camelcase}Controller".constantize.new controller.action_name = params[:action] controller.request = ActionDispatch::Request.new('rack.input' => []) controller.request.path_parameters = params.with