Click here to Skip to main content
15,614,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was redirecting my View to Controller in .Net.But when i write
it redirected the page successfully,and when i checked my page view source it was generating url to my controller.But when i accidentally typed
it does not redirected to my controller,and when i checked view source of my page it was only generating the name of my controller.So are they different?is so,where to use which one?Please help.Thanks for your help.

What I have tried:

Updated 14-Mar-16 3:03am

1 solution


It generates a URL as per provided action name, contrillername, route object.
It contains 8 overload methods.


It calls child action in a controller and return Html string as result.
It contains 6 overload methods.

Controller action:
public class MyController
	public ActionResult ActionMethod() 
		var menu = GetMenuFromSomewhere();
		  return PartialView(menu);

Use @Url.Action() when you are redirecting any page, you can use that in
<a href="@Url.Action("Action")">click</a>

In other hand you need to use @Html.Action() when you need result as HTML string. You can bind partial in your view page.
Share this answer
vaibhav1800 6-Dec-18 8:23am    
Any Scenario where you prefer to use Url.Action over Html.Action ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900