How to know the link of the call View () .NET MVC

2

I have a controller with a view at the end to show details of a company. I am making a code that allows you to generate a url for the company details through goo.gl to make it easier and more enjoyable to share, and I need to put as a parameter the input to the view . This link is stored in the database, associated with my template. See:

public ActionResult scoreDetails(int id)
{        
    res = PresentationServices.Helper.GetCompanyDetails(id);                
    //ShortLink 
    ViewBag.shortLink = 
    PresentationServices.Helper.GetCompanyShortLink(id, "LINK PARA A VIEW" );
    return View(res);
}
    
asked by anonymous 23.02.2017 / 19:06

1 answer

2

The simplest way to do this is through Request.RequestUri.PathAndQuery :

ViewBag.shortLink = 
    PresentationServices.Helper.GetCompanyShortLink((int)id, Request.RequestUri.PathAndQuery);
    
23.02.2017 / 19:17