Questions tagged [urlhelper]
113 questions
1
vote
2 answers
can't access to an extension method with UrlHelper parameter in controller! Vice versa in view have access
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 {…

Sadegh
- 4,181
- 9
- 45
- 78
1
vote
1 answer
Use button_to for external link via GET
As a test, I used both link_to and button_to, but only the former is working. With the latter, it looks like the params are just not passed, because I get an error from Facebook saying there's no client_id when there certainly is in the URL.
link_to…

james
- 3,989
- 8
- 47
- 102
1
vote
1 answer
Routes URL helper leading to example.com
Mailer file
button_to 'YES', lender_accept_url(borrow), method: :post, id: "accept #{borrow.id}", style: "background-color:green; color: white; width: 40px; display: inline"
button_to 'NO', lender_decline_url(borrow), method: :post, id: "decline…

james
- 3,989
- 8
- 47
- 102
1
vote
1 answer
Protocol relative URLs missing port in Rails URL helpers
I'm trying to generate protocol relative URLs using Rails URL helpers. For this I set the protocol option to false. But whenever I generate a URL, the port part is missing.
dashboard (master) > rails c
Loading development environment (Rails…

guiocavalcanti
- 13
- 3
1
vote
2 answers
escaping forbidden character in anchor codeigniter
I have a link to a modal
echo anchor('welcome/test/?$userid', 'Full View', 'class="ajax"');
and when my modal opens i retrieve it
$id= $_GET;
reason being is that when you click the "full View" link the modal opens and display different content…

darrrrUC
- 311
- 2
- 15
1
vote
1 answer
Why doesn't this link_to url helper update the boolean record?
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…

Kevin Dewalt
- 757
- 9
- 24
1
vote
0 answers
UrlHelper in .net web api builder
I'm building a web api and I have for example this controller,
[RoutePrefix("api/v{version}/profile")]
public class ProfileController : BaseController
{
private readonly IPersonService _personService;
private readonly IPersonDtoBuilder…

mitomed
- 2,006
- 2
- 29
- 58
1
vote
1 answer
need to unit test a controller's ActionMethod that is returning a RedirectResult along with an anchor tag
Here is the controller's return statement:
var url = Url.Action("method", "controller", new { id = id }) + "#anchor-tag";
return new RedirectResult(url);
So, in my test method, I need to assign the Controller's (sut) UrlHelper so I don't get a null…

Michael McCarthy
- 1,502
- 3
- 18
- 45
1
vote
1 answer
MVC UrlHelper called from Service
I have a static class that sends emails with links to certain pages of my site. That link is getting dynamically generated with this code:
UrlHelper urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
string url =…

CodingYourLife
- 7,172
- 5
- 55
- 69
1
vote
1 answer
Avoid hardcoded strings in UrlHelper.Action and ModelState.AddModelError
I have the following code-lines:
return Json(new { redirectTo = UrlHelper.Action("Index", "Home") });
and
ModelState.AddModelError("Useraccount.Email", emailAlreadyExistsException.Message);
For both the UrlHelper.Action method and the…

mosquito87
- 4,270
- 11
- 46
- 77
1
vote
2 answers
UrlHelper.Action() skipping over empty properties
The model below used in two ways:
public class SimpleModel
{
public DateTime? Date { get; set; }
// Some other properties
public SimpleModel()
{
Date = DateTime.Now;
}
}
When model is used in the form, generated URL…

Bob Sponge
- 4,708
- 1
- 23
- 25
1
vote
2 answers
How To add more element to nav_link on current_page?
I have some static pages in a navigation menu. I want to add more element to the item which is currently displaying.
navigation on view layout/adminzor.html.erb
-
<%= nav_link 'Dashboard', adminzor_path %>

GeekToL
- 1,815
- 1
- 24
- 46
1
vote
1 answer
url.Action with MvcContrib generates invalid links
In our application we use MvcContrib for generating links with the exception of cross area links where Contrib seems to be not working properly (or we are doing something wrong). In services we have a function that generates a List< ZakladkaModel >…

AdrianCogiel
- 131
- 2
- 13
1
vote
2 answers
How to createe a URL string based on a named route and keep parameters
I need to create urls for category switching, switching category should reset page to 1st and change cat name but keep rest of url params.
Example of…

stawek
- 257
- 2
- 5
- 13
0
votes
2 answers
Codeigniter $this->email->send() function causing errors cannot modify header information
I have two function in one codeigniter controller which will set the payment status of user and send email. one main function will call send_mail. send_mail function will returns true or false. then in that main function, user will be redirected…

aTFa
- 33
- 1
- 7