0

I'm trying the following code to build an URL-

var httpPath= System.Web.VirtualPathUtility.ToAbsolute("~/ExcelFiles/" + fileName);

It returns -

/ExcelFiles/7b6ce1b2-828e-4c89-a893-bd32a00cd2e2.xlsx

But I want it to be -

http://my_site_address/ExcelFiles/7b6ce1b2-828e-4c89-a893-bd32a00cd2e2.xlsx

Any help?

tereško
  • 58,060
  • 25
  • 98
  • 150
s.k.paul
  • 7,099
  • 28
  • 93
  • 168
  • 1
    Does this solves your problem? http://stackoverflow.com/questions/2069922/getting-full-url-of-any-file-in-asp-net-mvc – A G Aug 06 '15 at 05:40
  • try this var httpPath = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"))+"/ExcelFiles/" + fileName; – Arunprasanth K V Aug 06 '15 at 06:33

0 Answers0