How To Redirect Google.com using ActionLink in MVC

Posted by Nksingh420 under C# on 11/12/2012 | Points: 10 | Views : 2989 | Status : [Member] | Replies : 1
I am using MVC3 and i want to redirect http://www.google.com when i click in ActionLink




Responses

Posted by: Funda on: 11/14/2012 [Member] Starter | Points: 25

Up
0
Down
There are two possiblities ....
1) Use Anchor Tag. Since The Html.Action link is a Anchor tag in UI
<a href="http://www.google.com">Google</a>


2) Re direct it in Controller
Html.ActionLink(

"Google", // <-- LInk Text
"MyAction", // <-- ActionMethod
"MyController" // <-- Controller Name.
)


public ActionResult MyController(){

// do your logging here
return Redirect("http//www.google.com");
}


Nksingh420, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response