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
  • 57,247
  • 24
  • 95
  • 149
s.k.paul
  • 6,663
  • 24
  • 88
  • 159
  • 1
    Does this solves your problem? http://stackoverflow.com/questions/2069922/getting-full-url-of-any-file-in-asp-net-mvc – Aseem Gautam 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