Is it possible in my RegisterRoutes method in global.asax, to map some routes to an asmx?
Ideally I would like to do something like:
routes.MapPageRoute("ServiceSearchCats", "services/search/cats", "~/Services/Search.asmx/Cats");
(and therefore my endpoint for the service becomes "http://mydomain.com/services/search/cats", instead of...
I'm wondering if it is possibile to customize routing in a way that all requests are evaluated by a piece of code, redirected to the relevant controller if a match is found or passed to next rout in list if not found.
sample request:
/my coolpage/another one
the code searches and determine that the right controller for this is
Page, ac...
So basically what I want to do is have my routes.php setup so that if the route is defined then it uses that routing rule else it does something like this:
domain.com/VAR/controller/method/(vars) to domain.com/controller/method/var/(vars)
I think it can be done with a regex, but my regex-fu is very weak. Any tips would be greatly appre...
Hi all,
I have an app where a 'user' belong to a 'client' or a 'vendor' (and client and vendor has_many users). In the admin namespace, I want to administer these users - so an admin would choose a client or a vendor, then nav to that client's or vendor's users. My question is, short of making the user model polymorphic, how could I mod...
I have this routes:
resources :tags do
resources :comments
end
so the :create action for the comments has the following form
tag_comments POST /tags/:tag_id/comments(.:format)
how can i change the paramenter name from :tag_id to :commentable_id?
...
I've been reading up on MVC2 which came in VS2010 and it sounds pretty interesting. I'm actually in the middle of a large multi-tenant application project, and have just started coding the UI. I'm considering changing to MVC as I'm not that far along at this point. I have some questions about the Routing capabilities, namely are they req...
if somebody type URL/frewfrefew, he gets a routing error.
how do i get this invalids routes to point to the main page of the application in Rails.
thnaks
...
I have a route:
"{culture}/{controller}/{action}/{id}",
new { culture = "en", controller = "Home", action = "Index", id = UrlParameter.Optional }
The Url becomes
http://mysite.com
I want to show the culture name so that the url will look like this:
http://mysite.com/en
...
Hi all,
I've a small issue with URL generation & routing under ASP.NET MVC 2. My route has optional parameters and the URL is correctly generated if the parameters are specified.
Thus:
routes.MapRoute("Blog", "Articles/{tag}/{page}", new { controller = "Blog", action = "Index" });
with:
<%: Html.ActionLink(item.Tag, "Index", "Blog"...
I require nested subdirectories in my sinatra app, how can I simplify this repetitive code?
# ------------- SUB1 --------------
get "/:theme/:sub1/?" do
haml :"pages/#{params[:theme]}/#{params[:sub1]}/index"
end
# ------------- SUB2 --------------
get "/:theme/:sub1/:sub2/?" do
haml :"pages/#{params[:theme]}/#{params[:sub1]}/#{...
The routing I need is quite simple, I must be missing something there. As code example I put the simpler situation where I can reproduce my behavior.
You have this ActionMethod :
public ActionResult Index(string provider)
{
ViewData["Message"] = provider;
return View("Index");
}
And you have this route :
routes.MapRo...
When i use only langRoute and moduleRoute i have not any problems. But when i add pageRoute it is not work properly. I have tried many another ways do it (Regex etc) but none gives the desired result. Can anybody help me?
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
//Route_page needs dispatcher and req...
I've looked at the routing on StackOverflow and I've got a very noobie question, but something I'd like clarification none the less.
I'm looking specifically at the Users controller
http://stackoverflow.com/Users
http://stackoverflow.com/Users/Login
http://stackoverflow.com/Users/124069/rockinthesixstring
What I'm noticing is that the...
Hi there.
I'm working on a Zend Framework project where I've stumbled across a bit of a problem.
The problem originates from the fact that modules are 2nd class citizens in Zend Framework. In my project, I'd like for each module to have a folder containing files which are to be accessed from the outside - files such as stylesheets, java...
To illustrate:
class Customer
has_many :sales_orders
end
class SalesOrder
belongs_to :customer
end
i want to have customer to list sales_order which is ready to be sent, should i:
put the routing http://.../sales_orders/can_be_delivered or
create a new controller for reporting http://.../reports/sales_orders_can_be_delivered
...
I am rendering a new action but somehow getting the "index" URL. To be more specific, my create action looks like this:
class ListingsController < ApplicationController
def create
@listing = Listing.new(params[:listing])
@listing.user = @current_user
if @listing.save
redirect_to @listing
e...
I have a route with several optional parameters. These are possible search terms in different fields. So, for example, if I have fields key, itemtype and text then I have in global.asax:
routes.MapRoute( _
"Search", _
"Admin.aspx/Search/{Key}/{ItemType}/{Text}", _
New With {.controller = "Admin", .action = "Sea...
Many MVC frameworks (e.g. PHP's Zend Framework) have a way of providing basic state management through URLs. The basic principle is this:
Any parameters that were not explicitly modified or un-set get copied into every URL
For instance, consider a listing with pagination. You'll have the order, direction and page number passed as URL p...
In Ruby on Rails,
http://localhost:3000/foobars/alt/1
works
but
http://localhost:3000/foobars/alt/1.xml
doesn't work.
config/route.rb is
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
so supposedly it supports an id.format in the URL?
...
In routes.rb
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
but then
http://localhost:3000/foobars/alt
will work too. The params are:
{"action"=>"alt", "controller"=>"foobars"}
so looks like :id is optional here. How can you tell it is optional vs not optional? Can you make it so that...