Questions tagged [url.action]

In ASP.NET MVC the URLHelper provides a method called Action that generates a fully qualified URL to an action method by using the specified action name, controller name, route values, and protocol to use.

In ASP.NET MVC, Controllers and Views has a property called Url that exposes a URLHelper type, which help to create URL address.

The URLHelper provides a method called Action that generates a fully qualified URL to an action method by using the specified action name, controller name, route values, and protocol to use, for sample:

<a href="@Url.Action("Create", "Product", new { area = "Sales" })">New Product</a>

See de MSDN documentation.

143 questions
2
votes
1 answer

Hiding content until MathJax is complete

My website has a good amount of MathJax, and I am using the following code to prevent certain objects from being visible on the page until all of the MathJax formulas have been rendered. $("#myDiv").load('@Url.Action("ActionResultMethod",…
Gabe Conant
  • 367
  • 1
  • 5
  • 13
2
votes
1 answer

How to call different method in different Controllers in MVC Url.Action?

In my View I am using this form method:
So "Index" is method in Controller - UserA: public ActionResult Index(SearchParameters parameters, UserModel userModel) My question is, how to add in this…
geekforfreek
  • 136
  • 1
  • 3
  • 15
2
votes
0 answers

ASP.net Url.Action parameter is being forced to lowercase

I working with a site which uses obfuscated ids to display the URL/route. Instead of controller/edit/23 it would show something like /controller/edit/ftoGI8yFctjGPLYBl1ButA%3d%3d I'm trying to redirect to the /edit route after a user…
Josh
  • 451
  • 8
  • 22
2
votes
1 answer

Url.Action combines previous URL with current route parameters in JavaScript in VS IDE

I am generating an URL in JavaSctipt. The first time I generate this URL I get the correct URL: E.g. **http://localhost:54415/NffCall/Details/DK/6607726** But the next time I generate the link I get the previous link combined with current…
Rune Hansen
  • 954
  • 3
  • 16
  • 36
2
votes
1 answer

Url.Action becomes null when in JSON string

Bit of a noob with testing so please bear with me, I have a controller that returns a JsonResult that contains a string calculated by Url.Action like this: public ActionResult GetResult(SomeModel model) { if (ModelState.IsValid) { …
Nick
  • 2,877
  • 2
  • 33
  • 62
2
votes
1 answer

Unit test mock Url.Action

I'm writing unit test using the Moq framework and I have a controller function that returns return Json(new { redirectUrl = Url.Action("Action", "Controller"), isredirection = true }); I want to be able to test the result in…
user473104
  • 301
  • 2
  • 6
  • 17
2
votes
1 answer

Url.Action MVC3 not recognizing route parameter when building link

When adding custom routing constraints to my route parameters I am finding that it is breaking the Url.Action method I use to build my links. If the route constraint is simply a regular expression then the Url.Action method continues to recognize…
1
vote
2 answers

MVC3 Routing Working 1 Direction Only

I am working on an ASP.NET mvc 3 site that contains several project entities, and then each project has several associated subpages, each that works with a component of the project. So for instance, I could have a project with several photos,…
Adam
  • 1,202
  • 11
  • 25
1
vote
1 answer

web site url.Action problem javascripts help me?

$.each(data, function(i, item) { console.log(item); var _seoObj = { SeoBaslik: item.SeoBaslik } console.log(_seoObj); //var urlLink = 'PhotoGallery/Details/?seoTitle=' + _seoObj.SeoBaslik; var urlLink =…
1
vote
1 answer

Url.Action in controller generates port twice on Server

I referred this existing answer - but it didn't work. I am using below piece of code to generate a fully qualified url and pass it to script and use this url there to redirect. @section Scripts { @Html.Script(@