Read URL from an Internet Shortcut file
-
Hi, How to extract the URL from an Internet Shortcut (.url) file in ASP.NET/C#? What are the namespaces and classes required to read the information from a ".URL" file? Thanks in advance. Subrahmanyam K
-
Hi, How to extract the URL from an Internet Shortcut (.url) file in ASP.NET/C#? What are the namespaces and classes required to read the information from a ".URL" file? Thanks in advance. Subrahmanyam K
I can recommend you 2 things. First the really hard way :P http://www.msjogren.net/dotnet/eng/samples/dotnet_shelllink.asp[^] Second, you can open the file and get all the content of the url file. Like this :
using (FileStream fs = File.OpenRead(filename)) { byte[] b = new byte[1024]; UTF8Encoding temp = new UTF8Encoding(true); while (fs.Read(b, 0, b.Length) > 0) { string content = temp.GetString(b); } }
Then you will probably be able to get it with a regular expression. My Blog -- modified at 9:55 Monday 10th July, 2006