routing

Considerations when turning on RouteExistingFiles

♀尐吖头ヾ 提交于 2019-11-29 11:37:24
I am looking to generate some CSS files dynamically in my Content folder. At the moment, this folder has an ignore route ( routes.IgnoreRoute("Content/{*wildcard}"); ) and, I'd like that to remain, as I don't need/want most of my content folders to go into the MVC request lifecycle. Example: routes.MapRoute( "DynamicCSS", "Content/Css/Dynamic/{guid}.css", new { controller = "Site", action = "GenerateCSS" }, new { guid = @"^([0-9a-fA-F]){8}([0-9a-fA-F]){4}([0-9a-fA-F]){4}([0-9a-fA-F]){4}([0-9a-fA-F]){12}$" } ); //If the file has already been generated, IIS should just return the file, saving a

Custom REGEXP Function to be used in a SQLITE SELECT Statement

巧了我就是萌 提交于 2019-11-29 11:36:51
I have an SQLITE Database's File which in one of the table columns there is some simple Regular Expressions. These Expressions are something like /foo(. ?) or /foo/bar/(.?) and so on... Well, when we try to match some text against a Regular Pattern, in PHP, we do: preg_match( $pattern, $target, $matches ) Replacing the variables with the content, obviously. What I would like to do is send ANY STRING as value of a WHERE Clause and, when searching the SQLITE Database's File, use each of the stored Regular Expressions to match a pattern in the given string. I think that using PHP's sqlite_create

ASP.NET MVC: Many routes -> always only one controller

和自甴很熟 提交于 2019-11-29 11:34:59
I have very simple question. My site, based on ASP.NET MVC, can have many urls, but all of them should bring to the one controller. How to do that? I suppose I need some magic in Global.asax but I don't know how to create route that will redirect any url to the specific controller. For example I have url /about, /product/id etc. but all of them should be really bring to the content/show where the parts of url will be recognized and the decision what information to show will be make. It's some like CMS when you cannot define routes in advance. Is this information enough? Thanks This sounds like

Laravel slash after url redirects to root folder

情到浓时终转凉″ 提交于 2019-11-29 11:16:42
I'm new to Laravel and it seems a great framework but i have a question when it comes to routing. I want to route all get requests to one controller action named PageController@view but when the prefix is admin i want it to route to Admin\AdminController@view. I have the following code: Route::get('/{slug?}', 'PageController@view'); Route::group(array('prefix' => 'admin', 'namespace' => 'Admin', 'before' => 'auth'), function() { Route::get('/', 'DashboardController@main'); }); But when i go to: /admin, Laravel treats it like a slug instead of a prefix. Is there somekind of except function for

How can I append .html to all my URLs in cakephp?

寵の児 提交于 2019-11-29 11:15:45
I am using cakephp in one of my projects and my client wants the site URLs to end with .html and not the usual friendly urls. I was wondering if its possible in cakephp to do so through any of its routing techniques. Please help. That is well documented in the cookbook . UPDATE: http://book.cakephp.org/2.0/en/development/routing.html#file-extensions To handle different file extensions with your routes, you need one extra line in your routes config file: Router::parseExtensions('html', 'rss'); If you want to create a URL such as /page/title-of-page.html you would create your route as

How to redirect a named route with querystring in Laravel 4.2

亡梦爱人 提交于 2019-11-29 11:04:00
I am new to Laravel framework. I am using 4.2 my question is i had a pagination functionality in a manageemployee page, I have created a route for manageemployee page. Route::get('/usercp/manageemployee',array('uses' =>'ManageEmployeeController@getManageCompanyEmployee','as' =>'getManageCompanyEmployee')); In this page i have pagination , if user was in third page, he want to delete one record. now the page looks like /usercp/manageemployee?page=3 After deleting a particular record in that page i need to redirect user to the same page. My Redirect code as follows return Redirect::route(

Can anyone recreate the following bug I'm experiencing in routes with 2 or more optional parameters, in .NET 4.0 / MVC3?

爱⌒轻易说出口 提交于 2019-11-29 10:58:41
I know that if you think you found a bug in the .NET framework you are most likely wrong, but that's why I'm writing this question, so please hear me out. I am fairly certain that there is a difference between the routes in .NET 3.5 and .NET 4.0 when it comes to optional parameters. Specifically if you have more than one optional parameter in your route. I have not been able to find this breaking change noted in any release notes of either .NET 4.0 or MVC 3 so thats why I call it a bug. EDIT: This bug only manifests itself when you try to build a route url using code like the url or html

Set Express response headers before redirect

两盒软妹~` 提交于 2019-11-29 10:18:40
I'm implementing a site login that takes in an email/password combo, retrieves an API token, and returns it to the user to get stored (encrypted) in localStorage. Currently, on successful POSTing to /login , the app redirects the user to the index page, with the token attached as a query, like so (as suggested here ): login.post('/', function(req, res) { ...checking password... Auth.getToken(user, function(err, token) { res.redirect('/?token=' + token); }); }); This works fine, but I'd prefer to keep my URLs as clean as possible and set the token as a header instead: login.post('/', function

Find distance of route from get.shortest.paths()

匆匆过客 提交于 2019-11-29 09:54:17
问题 I'm using the igraph package in R to do something rather simple: Calculate the shortest distance between two nodes in my network. Is there a straightforward way to extract the distance of a path calculated via get.shortest.paths() ? Here is some reproducible code that exemplifies my problem: ## reproducible code: df2 = rbind(c(234,235,21.6), c(234,326,11.0), c(235,241,14.5), c(326,241,8.2), c(241,245,15.3), c(234,245,38.46)) df2 = as.data.frame(df2) names(df2) = c("start_id","end_id","newcost

React Router v4 Nested match params not accessible at root level

穿精又带淫゛_ 提交于 2019-11-29 09:43:22
Test Case https://codesandbox.io/s/rr00y9w2wm Steps to reproduce Click on Topics Click on Rendering with React OR Go to https://rr00y9w2wm.codesandbox.io/topics/rendering Expected Behavior match.params.topicId should be identical from both the parent Topics component should be the same as match.params.topicId when accessed within the Topic component Actual Behavior match.params.topicId when accessed within the Topic component is undefined match.params.topicId when accessed within the Topics component is rendering I understand from this closed issue that this is not necessarily a bug. This