Questions tagged [urlhelper]

113 questions
9
votes
3 answers

How to add the slug to all Link generation in an asp.net core website?

I need to be able to control the links being generated by my Url.Content("~") call to be able to accept a Slug in the beginning of the link. Basically the hosting URL will be behind a Load-balancer and may be at the root level or behind a friendlier…
ewassef
  • 286
  • 2
  • 13
6
votes
1 answer

What is the difference between UrlHelper.Route and UrlHelper.Link methods?

Looking at the msdn (UrlHelper.Route, UrlHelper.Link) they seem quite identical. Are there any reasons to use one or the other?
Jacek M
  • 2,349
  • 5
  • 22
  • 47
6
votes
1 answer

How to get application base url while behind reverse proxy

Is there any way for an ASP.NET application to be able to derive its url paths and hostname knowing its own routes within the context of a request going through reverse proxy/gateway? When requesting this url via a…
mirezus
  • 13,892
  • 11
  • 37
  • 42
6
votes
4 answers

First call to Url.Action on a page is slow

I have a performance issue with a fairly simple ASP.MVC view. It's a log-on page that should be almost instant, but is taking about half a second. After a lot of digging it looks like the problem is the first call the Url.Action - it's taking around…
Keith
  • 150,284
  • 78
  • 298
  • 434
6
votes
1 answer

Rails 3 URL without controller name

Suppose I want to have a blog with Rails 3 on my website and it will be the only thing I have on it. I would like to use Rails to implement it but I don't like the URLs Rails produces. I would like URLs like this: example.com/2012/05/10/foo I don't…
Jeena
  • 2,172
  • 3
  • 27
  • 46
5
votes
2 answers

UrlHelper.Action: would like to generate a link that ends with '#something'

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…
Liz
  • 378
  • 3
  • 19
5
votes
1 answer

UrlHelper.Action throws ArgumentNullException

I am using the UrlHelper to generate an URL, however, I am getting the ArgumentNullException when I call the method Action(action, controller, route). UrlHelper urlHelper = new UrlHelper(); if (!string.IsNullOrEmpty(notificacao.NotAction)) { …
Dan
  • 1,518
  • 5
  • 20
  • 48
5
votes
0 answers

UrlHelper.Action return empty string

very weird problem, I spent hours but not be able to find what exactly the problem is. I have some code as follows: public static string AbsoluteAction(this UrlHelper urlHelper, string actionName, string controllerName, object routeValues) …
5
votes
1 answer

Generating a URL independant of controllers in ASP.NET MVC 3

I have an mvc 3 application with a background thread checking on the state of some database items. When it finds an expired item, it sends out an email. In the email, I would like to include the url for the action to call to see the status. If…
Simon Parker
  • 1,656
  • 15
  • 37
5
votes
3 answers

Rails: make custom URL helper behave like built in _path & _url helpers

I'm having a hard time figuring out the "Rails Way" to add a email confirmation URL to a mailer. I'm opting not to do this purely RESTfully because, well, it's difficult with text email because they can't PUT requests. so here's my routes.rb: get…
Meltemi
  • 37,979
  • 50
  • 195
  • 293
5
votes
3 answers

Access url_helper from an Engine class

I try to access URL helper from inside a Module class. Here's my code : module Station class Plugins @@plugins = [] unless defined?(@@plugins) && @@plugins.class == Array class << self def all return @@plugins.sort_by {…
AkyRhO
  • 187
  • 2
  • 11
4
votes
1 answer

Using an extension of UrlHelper without reference in chtml page

I have an extension of UrlHelper, I'll use on every page chtml. Do I have any way to refer to this extension without having to do it by using? UrlExtender.cs using System; using System.IO; using System.Web.Mvc; namespace MySite.Web.MVC.Extender { …
andres descalzo
  • 14,887
  • 13
  • 64
  • 115
4
votes
2 answers

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" }, …
iasksillyquestions
  • 5,558
  • 12
  • 53
  • 75
4
votes
1 answer

Zend URL helper and custom routes?

I can't figure this out. How do you use the url helper with custom routes? I have a method in my users controller called edit and I have a custom route for it so it can be called through domain.com/settings (instead of domain.com/users/edit) When I…
user393964
4
votes
1 answer

ASP.NET Core resolve url in startup?

I would like to be able to register certain url's that take into account actual url of the resources. Specifically: the Swagger end point for my Web API documentation. public void Configure(IApplicationBuilder app, IHostingEnvironment env,…
Sigurd Garshol
  • 1,376
  • 3
  • 15
  • 36