ASP.NET MVC - Routes and UrlHelper
I have the following route routes.MapRoute( "GigDayListings", // Route name "gig/list/{year}/{month}/{day}", // URL with parameters new { controller = "Gig", action = "List" }, new { year = @"^[0-9]+$"...
I have the following route routes.MapRoute( "GigDayListings", // Route name "gig/list/{year}/{month}/{day}", // URL with parameters new { controller = "Gig", action = "List" }, new { year = @"^[0-9]+$"...
Hello, One of my controllers actions, one that is being called in an Ajax request, is returning an URL to the client side so it can do a redirection. I'm using Url.RouteUrl(..) and during my unit tests this fails since the Controller.Url parameter is not pre-filled. I tried alot of things, among others attempting to stub UrlHelper (whi...
can anyone tell me why my redirect helper doesn't work the way i'd expect. i'm trying to redirect to the index method of my main controller like so: if($provider == '') { redirect('/index/provider1/', 'location'); } but that takes me www.mysite.com/index/provider1/ when it should go to www.mysite.com/provider1. does that make sen...
I created a simple extension method for the ASP.NET MVC UrlHelper. It takes no arguments as its job is to look up the name of a stylesheet file from the configuration and return a url to the stylesheet. The extension method looks roughly like this: public static string SiteStylesheet(this UrlHelper urlHelper) { var scriptFilename = ...
I'm trying to write a test for an UrlHelper extensionmethod that is used like this: Url.Action<TestController>(x => x.TestAction()); However, I can't seem set it up correctly so that I can create a new UrlHelper and then assert that the returned url was the expected one. This is what I've got but I'm open to anything that does not inv...
Hi, I'm using Zend-Framework 1.9.5 to make a web-application, But it's Url_Helper was quite tricky to me in the matter of parameter reset!, I know it's a good feature (parameter preserving) but in most cases I don't need it!. So I'm thinking of overriding the default Router to force it loosing parameters Unless I ask for it or maybe spec...
I need to generate some URLs in a model in ASP.NET MVC. I'd like to call something like UrlHelper.Action() which uses the routes to generate the URL. I don't mind filling the usual blanks, like the hostname, scheme and so on. Is there any method I can call for that? Is there a way to construct an UrlHelper? ...
Thanks in advance. Tried to provide as much detail as possible. Attempting to create a link that updates a boolean record in a database. Basically, someone can mark a gift as purchased without going a separate form. I've done this in the past with post and delete links without problems. :post not accepted by controller (only I get:...
Hi Guys I'm not sure if I have my question named correctly but here's the issue: I have an MVC.NET app that is deployed at multiple virtual directories. The reason for this is because we have different versions under various stages of QA. The problem with this is that in one site the .js references are for /VirtualDir/scripts/fi...
You can use the URL helper in Code Igniter to load CSS and Javascript with the base_url() method, but what if you have images dynamically being placed into your HTML via javascript? for example in my javascript file I've got var arrowimages={down:['downarrowclass', 'images/down.png', 23], right:['rightarrowclass', 'images/right.png']} ...
why defined extension method with UrlHelper don't added in Url.EXTENSIONMETHOD when i want to use it in controller! but i have access to it in view? public static string Home(this UrlHelper helper) { return helper.RouteUrl("ABC", new { controller = "ABC", Action = "Default" }); } i haven't access: public ActionResult Default() { ...
I want to write an HtmlHelper to render an ActionLink with pre-set values, eg. <%=Html.PageLink("Page 1", "page-slug");%> where PageLink is a function that calls ActionLink with a known Action and Controller, eg. "Index" and "Page". Since HtmlHelper and UrlHelper do not exist inside a Controller or class, how do I get the relative UR...
This is how I'm doing it now: link_to "Profile", :controller => "profiles", :action => "asked", :id => @profile # => <a href="/profiles/asked/1">Profile</a> Does it make more sense for the URL to be <a href="/profiles/1/asked">Profile</a>? Profile 1 asked some number of questions, so it makes more sense to me for the URL to look like...
I'm trying to add an extension method to my MVC 2 project without success and after several hours of googling and looking here I'm at a loss. I've created a brand new MVC 2 project to make sure there was not anything weird about my existing project and I'm still facing the same problem. I'm sure this is a situation of I "can't see the ...
Hi, I'm trying to create a link with Url.Action, which ends with a #something; I presume there's something in the route values to do this properly, but I couldn't find it with Google. So far, I tried Url.Action("action", "controller", new {id="something", Area="area"}). The resulting link is the expected /action/controller/area, but I c...
Hi, i am trying to move my business logic out from the controllers and into their own services. I have setup my controller like so: public class AccountController : Controller { private readonly IAccountService _accountService; public AccountController(IAccountService accountService) { _accountService = accountSer...
Hi, I got a adress like this : ~/Content/Files/AdImages/20/20_thumb.jpeg, I need this to be resolved. This was done in ASP.net with Control.ResolveUrl(). According to this article http://stephenwalther.com/blog/archive/2009/02/18/asp.net-mvc-tip-47-ndash-using-resolveurl-in-an-html.aspx, I should use somthing like this : urlHelper.Co...
Hi guys, I am trying to figure out, how can I automatically submit a url at the following page http://www.facebook.com/sharer.php without actually clicking on the submit button. Thanks. ...