url-routing

The value for annotation attribute RequestMapping.value must be a constant expression

安稳与你 提交于 2019-11-28 04:57:41
问题 When using the following code snippet: public class MyUrls { // properties get initialized using static{...} public final static String URL_HOMEPAGE = properties.getProperty("app.homepage"); } @Controller public class HomepageController { @RequestMapping(MyUrls.URL_HOMEPAGE) public String homepage() { return "/homepage/index"; } } I get the following error: The value for annotation attribute RequestMapping.value must be a constant expression But in fact, URL_HOMEPAGE does be a constant, since

Page.RouteData.Values are empty for one page but not another

这一生的挚爱 提交于 2019-11-28 04:40:30
问题 I have Routing working in ASP.NET c# WebForms using Microsoft.AspNet.FriendlyUrls but not for all pages. Here is an example: routes.MapPageRoute("List/{Location}/{ZipCode}/", "List/{Location}/{ZipCode}/", "~/List.aspx"); On the above mentioned page (List.aspx) in the page_load there are no values.count in the Page.RouteData. Page.RouteData.Values.Count == 0 I have another page in the same site with this info matched to it: routes.MapPageRoute("{Location}/{ZipCode}/{Name}/{LocID}/{ID}/{Code}/"

Auto-versioning in ASP.NET MVC for CSS / JS Files?

℡╲_俬逩灬. 提交于 2019-11-28 04:34:19
I have read lots of article on how to auto-version your CSS/JS files - but none of these really provide an elegant way to do this in ASP.NET MVC. This link - How to force browser to reload cached CSS/JS files? - provides a solution for Apache - but I'm a little confused how this could be implemented via ASP.NET MVC ? Would anyone be able to provide some advice how to do this on IIS7 and ASP.NET MVC - so that CSS/JS files automatically have a version number inserted in the URL without changing the location of the file ? That is, so links come out link this etc presumably using the URL Rewrite

How to pass a Persian string as a argument in the URL?

假装没事ソ 提交于 2019-11-28 03:42:04
问题 I have a URL like this pattern: www.example.com/ClassName/MethodName/Arg1/Arg2 Also here is my .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA] ErrorDocument 404 /error404.html And this is my routing system: if (empty($_GET['rt'])) { require_once('application/home.php'); } else { require_once('application/search.php'); $url = rtrim ($_GET['rt'], '/'); $url = explode('/', $url); $ClassName =

How to generate url for a route in Ember.js

旧街凉风 提交于 2019-11-28 02:50:47
问题 I am wondering how is possible to generate url for a given route. My scenario I have list of calls (db entity) and user can select several calls and share them with other people via email. After submition of selected calls is created db row with hash and by relation contains selected calls. Now I need generate link which can be sended by e-mail. This link is not the same route as list of call's route. So the question is: Is it possible to generate url by route and params in Ember.js? Thank

Dot character in ASP.NET MVC 3 route parameters

前提是你 提交于 2019-11-28 02:01:28
问题 I have no custom routes in my application, only the default one. If i try to open localhost/myapp/controller/action/bla.bla it works fine on my machine (Windows 7 x32, both Cassini and IIS) but fails on the server (2008 R2 x64). Found similar question but the solution doesn't work. Also, found this article where Eilon says it's a special character for MVC and it's "by design". Why there is difference between my machine and the production box and how do i fix it? Update : the problem site has

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

岁酱吖の 提交于 2019-11-28 01:39:05
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(); app.use(express.static('public')); app.get('/contact', function(req, res){ res.sendFile('public/index

.htaccess and seo-friendly urls

拜拜、爱过 提交于 2019-11-28 00:33:31
We have an ecommerce site right now that carries a range of brands. The brand pages carry urls as follows: http://www.<DOMAIN>.com/catalog/brand/view?id=2 We need to utilize more friendly (seo-friendly) urls such as: http://www.<DOMAIN>.com/<BRAND> but such that it would resolve #1 above. Is this done in .htaccess files in the root? If so, what is the correct way to go about this? Keep in mind URL#1 is the legitimate address, but we want to utilize the URL#2 format for linking. It's not a 301 type redirect is it? That's more "permanent" unless I misunderstood it or something, no? Many thanks.

ASP.NET web pages without aspx file extension

感情迁移 提交于 2019-11-28 00:20:38
问题 What is best solution to serve ASP.NET web pages without aspx extension? I want to make http://www.mydomain.com/mypage instead of http://www.mydomain.com/mypage.aspx I use .NET 2.0 and IIS6 回答1: If you can upgrade to .Net 4.0,which got a built-in URL Routing feature to do it for you easily,read this article by Scott Mitchel otherwise if you don't want to move to .net 4.0,read this article by Scott Gu 回答2: Url rewriting . For .NET there are already modules available like this one. 回答3: For IIS

Rails routes with optional scope “:locale”

橙三吉。 提交于 2019-11-27 23:41:12
I'm working on a Rails 3.1 app and I'd like to set specific routes for the different languages the app is going to support. /es/countries /de/countries … For the default language ('en'), I don't want the locale to be displayed in the url. /countries Here is the route definition I've set. scope "(:locale)", :locale => /es|de/ do resources :countries end It works great, until I try to use a path helper with 'en' as the locale. In the console : app.countries_path(:locale => 'fr') => "/fr/countries" app.countries_path(:locale => 'en') => "/countries?locale=en" I don't want the "?locale=en". Is