Forward Slashes and BackSlashes have different Interpretations in programming languages. For Instance in C#, the Back Slash is used for commenting out Code. So, if you want to comment out code in C#, you would do something like this-
// int test_variable=5;
That is two forward slashes at the beginning of the line. This is all and good until one works with URL’s.
Everyone knows that a complete URL would appear to be like this-
A url contains the protocol followed by two forward slashes and the domain name. If you compare the code the URL with the code above, what do you notice?
You should notice that the URL contains “two forward slashes” which is actually the syntax for commenting out code in C# !! Clearly a conflict of Interest!
Which essentially means that if a compiler comes across the declaration of the string URL, it would only read until here
And it will Ignore the rest of the line, since the compiler thinks that the code is commented out.
How can this be fixed? How can we tell the compiler that the forward slashes in the URL do not Intend to be a comment but it is actually a part of the String?
All we have to do is to add a Back Slash in the front of each forward slash so that the compiler knows that it is not a comment.
This is how it should be-