routing

Ignore folder in ASP .NET MVC

旧时模样 提交于 2019-12-01 04:03:24
I have an existing ASP .NET MVC application and I would like to ignore a specific folder within it (where I intend to put PHP scripts). I have tried adding an ignore route as described here but it is not working because I am still getting standard ASP .NET configuration errors. For examples sake, imagine I have this folder structure: root+ | +--bin | +--test Based on my understanding, in my global.asax.cs file I think I should be putting this in the RegisterRoutes method: routes.IgnoreRoute("test/{*.pathInfo}"); What am I doing wrong? Thanks, Alan EDIT: Posted web.config <configuration>

ArgumentError: wrong number of arguments (1 for 2)

橙三吉。 提交于 2019-12-01 03:34:54
I'm very new to Rails, MVC, and CRUD, and I'm trying to use the update method to change the amount of votes on a post. I have the following code in my Posts Controller update method: def update @post = Post.find(params[:id]) if params[:vote] == 'up' @post.update_column(:ups => @post[:ups] + 1) elsif params[:vote] == 'down' @post.update_column(:downs => @post[:downs] + 1) end flash[:notice] = "Thanks for voting! This helps us determine important issues in our schools." redirect_to 'Posts#index' end and I have the following code in my routes.rb: OpenMCJC::Application.routes.draw do root :to =>

ASP.NET MVC Html.ActionLink result URL - the way of encoding

雨燕双飞 提交于 2019-12-01 03:27:29
问题 I create an amount of actions in MVC controllers. public ActionResult DoSmth1(string token) public ActionResult DoAnother2(string token) And when I have to call ActionLink.. =Html.ActionLink<SomeController>( x=> x.DoSmth(item.property), item.property) =Html.ActionLink<AnotherController>( x=> x.DoAnother(item.property), item.property) ...it generates me different URLs: /Some/DoSmth/stringvalue /Another/DoAnother?property=stringvalue Where to set the way it builds an URL? I am alr have no ideas

ASP.Net MVC route mapping

蹲街弑〆低调 提交于 2019-12-01 02:45:28
I'm new to MVC (and ASP.Net routing). I'm trying to map *.aspx to a controller called PageController . routes.MapRoute( "Page", "{name}.aspx", new { controller = "Page", action = "Index", id = "" } ); Wouldn't the code above map *.aspx to PageController ? When I run this and type in any .aspx page I get the following error: The controller for path '/Page.aspx' could not be found or it does not implement the IController interface. Parameter name: controllerType Is there something I'm not doing here? I just answered my own question. I had the routes backwards (Default was above page). Yeah, you

ASP.NET MVC Colon in URL

泄露秘密 提交于 2019-12-01 02:37:39
问题 I've seen that IIS has a problem with letting colons into URLs. I also saw the suggestions others offered here. With the site I'm working on, I want to be able to pass titles of movies, books, etc., into my URL, colon included, like this: mysite.com/Movie/Bob:The Return This would be consumed by my MovieController , for example, as a string and used further down the line. I realize that a colon is not ideal. Does anyone have any other suggestions? As poor as it currently is, I'm doing a find

Rails 3 Routing Constraint and Regex

和自甴很熟 提交于 2019-12-01 02:17:39
I'm looking to match the pattern state/city in the path, unless the state variable equals "auth" match '/:state/:city' => 'cities#index', :as => :state_cities, :constraints => {:state => /(?!auth)/ } For example, mydomain.com/fl/miami is good. mydomain.com/auth/twitter is bad. I am using omniauth and it requires that you go to /auth/twitter for authentication, however it is nowhere to be found when I type rake routes . Based on mu is too short's comments, here is the answer I've come up with: match '/:state/:city' => 'cities#index', :as => :state_cities, :constraints => OmniauthPassThru.new

CodeIgniter | .htaccess removing index.php from url

ε祈祈猫儿з 提交于 2019-12-01 01:37:05
问题 ok, i did exactly as asked in the documentation of codeigniter, created new file .htaccess RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] i am using xampp, so my url for accessing the site was http://localhost:12/projects/zorkif_nextgen/index.php/main now after applying the above .htaccess file, i tried it without index.php like this http://localhost:12/projects/zorkif_nextgen/main but instead of working, it is redirecting me to this url

Cakephp 3 routing with language parameter

喜欢而已 提交于 2019-12-01 01:31:30
问题 I'm trying to convert cakephp 2.x to 3.x. I was using Router::connect() rules, but I try to convert them to scope version. Regarding to myold routing rule, in config/routes.php I added this. Router::defaultRouteClass('Route'); Router::scope('/', function ($routes) { $routes->connect('/:language/:controller/:action/*', ['language' => 'ar|de|en|fr']); $routes->connect('/:language/:controller', ['action' => 'index', 'language' => 'ar|de|en|fr']); $routes->connect('/:language', ['controller' =>

Can I Render A Layout Directly From routes.rb, Without A Controller?

荒凉一梦 提交于 2019-12-01 01:20:04
问题 I would like to set up a pair of style guides for the admin and public sections of a website. Each will need its own layout which will contain a mixture of static html and calls to erb partials (so a static page won't cut it). I have no need of a controller(s) to serve these pages and I don't want what is effectively development-only content cluttering up the rest of the code. This got me wondering whether there is a way to render a layout directly. Disclaimer: I appreciate this is not

Dynamic Route Loading in Angular 2 Fails. (Beta)

点点圈 提交于 2019-12-01 01:16:52
I want to load routes for the @RouteConfig Dynamically from a service which fetches in format JSON, [ { "path" : "/about" , "name" : "About" , "component" : "AboutComponent" }, { "path" : "/contact" , "name" : "Contact" , "component" : "ContactComponent" } ] Following is the code for pushing it into the RouteDefinition Array, for (let i = 0; i < data.length; i++) { //console.log(data[i].path+" "+data[i].name+" "+data[i].component); this.routeConfigArray.push({ //routeConfigArray : RouteDefinition 'path': data[i].path, 'name': data[i].name, 'component': data[i].component }); this._router.config