locked
Windows Phone with C# / webRequest.GetResponse();

    Question

  • Hi,

    Ive written code in C# for windows console that works as follows:

                WebRequest webRequest = WebRequest.Create("http://www.somewebsite.com/img/somefile.png");
                WebResponse webResponse;
                try
                {
                    webResponse = webRequest.GetResponse();
                    Console.WriteLine("File exists " + webResponse.ResponseUri);
                    Console.ReadLine();
                }

    I want to check if a file at a given URL exists and do some action based on the file existing or not, this works ok in Windows as above, however I want to replicate this in Windows Phone but it seems that webRequest.GetResponse(); is not avalible in windows phone, does anyone know how I can validate a url in C# for Windows Phone?

    Thanks.


    Iain R. Lennox Software Development Student Cardonald College il35808@livemail.cardonald.ac.uk

    Wednesday, March 14, 2012 10:31 AM

Answers