Advertisements

Archive

Posts Tagged ‘XML’

Load XML from URL giving an error (The remote server returned an error: (401) Unauthorized.)

November 1, 2018 Leave a comment

If you are getting a 401 Unauthorized error while reading an XML from URL, here is the solution you can try

xml

Hope this help!

Advertisements
Categories: ASP.NET Tags: , ,

Useful tips while using bool.TryParse method

November 23, 2012 Leave a comment

Case I:

bool temp = bool.TryParse(“False”, out temp);

Console.WriteLine(temp);

Will always return true

Because bool.TryParse return true if string can be parsed into a bool and

the second parameter to TryParse is an out parameter the TryParse method is forced to initialize the parameter.

And after that we initialize same parameter with the value return by bool.TryParse so it will be set as true.

Case II:

bool temp;

bool.TryParse(“False”, out temp);

Console.WriteLine(temp);

In this case it will return false.

Hope this help!