0

Currently, we are having a hyperlink tag and the MVC action method is called directly from hyperlink as

<a href="/api/sitecore/{controller Name}/{action Name}"> Hyperlink Text

While hovering on the hyperlink text we are able to see the same link in the browser as /api/sitecore/{controller Name}/{action Name}.

Is there a way where we can hide the word Sitecore while calling the action method. So that while hovering also we will not be able to see it.

  • Is this POST action or GET action on click? – Marek Musielak May 27 '19 at 8:18
  • This is on the POST action – PVM May 28 '19 at 0:09
1

You can create your own custom route pipeline in sitecore and map to route the url link like below

public class YourCustomRouteName
{
    public virtual void Process(PipelineArgs args)
    {
        RouteTable.Routes.MapRoute(
            "customapi/linkhover", 
            "customapi/linkhover",
            new {
                controller = "YourAssemblyName.YourControllerName, YourAssemblyName",
                action = "YourActionName", 
                id = UrlParameter.Optional 
            }
        );
    }
}
<pipelines>
    <initialize>
        <processor type="YourAssemblyName.YourCustomRouteName, YourAssemblyName" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']" />
    </initialize>
</pipelines>
<a href="customapi/linkhover">

This way you can achieve to hide the word Sitecore while calling the action method in any link control .

Reference Link here

| improve this answer | |
  • Thanks Debal. Will check the link provided by you. – PVM May 28 '19 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.