0

I am decoding urls to purest form which browsers display and then storing them at the MS SQL db (nvarchar column type) with

      srRelativeUrl = HttpUtility.UrlDecode(srRelativeUrl);

My question is i am also fetching newly discovered urls with

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(srRelativeUrl);

Could there be any scenario this would cause error because url is not properly encoded ?

Ty very much for answers

Furkan Gözükara
  • 22,964
  • 77
  • 205
  • 342

1 Answers1

1

When ever you run into an invalid url it will generate an error message.So yes if the url is not properly formed you will most likely get exception.

So you can add this :

try
   {
    HttpWebRequest postReq = (HttpWebRequest)WebRequest.Create(url);
    ....res of your code.....
   }
catch (WebException p)
        {
            //You can record these errors in maybe database and later review them.
        }
confusedMind
  • 2,573
  • 7
  • 33
  • 74