Search code examples
c#asp.net-mvc-3actionlink

creating https actionlink


I am working asp.net mvc3. I have an action link like following:

 @Html.ActionLink("Yes", "Admin", "Foo", null, new { @class = "link" })

How can I modify this to create a link in https as oppose to http as I have set my controller action with [RequireHttps]


Solution

  • Ever looked at the documentation or the Intellisense that Visual Studio offers you?

    @Html.ActionLink(
        "Yes",                     // linkText
        "Admin",                   // actionName
        "Foo",                     // controllerName
        "https",                   // protocol
        null,                      // hostName
        null,                      // fragment
        null,                      // routeValues
        new { @class = "link" }    // htmlAttributes
    )