favicon - ASP.NET: How to get URL of a file? -


I want to get a fully qualified URL for a resource in ASP.NET

Example:

  & lt; LINK rel = "shortcut icon" href = "& lt;% = GetFaviconPath ()% & gt; & Gt;   

This code is currently inaccessible with the file behind:

  Private string GetFaviconPath () {string URL = system. Web. Virtual Path Utility Toबेसolute ("~ /Images/clock.ico"); Return url; }   

Unfortunately this does not work because it does not return the fully qualified path, only the path relative to the server:

  /Employement/Images/clock.ico   

Internet Explorer requires a fully qualified URL, such as:

  Http: // localhost: 6211 9 / jobs / images / clock .ico http: // revenge: 81 / jobs / images / clock. Http://MyFreeAspDotNetHosting.com/IanBoyd/Employment/Images/ Clock.ico   

I have a file completely How do I get le path? I have tried the Virtual Path Utility and I'm out of ideas.

try it

  string_aprint = httpContext.Current Request.Url.ToString ();   

Add your absolute path to your relative path.

Comments