skip to main
|
skip to sidebar
Yaron Naveh's Web Services 2.0 Blog
Node.js, backbone.js, mongodb, WCF
Pages
@YaronNaveh
Login
Thursday, April 1, 2010
Remember to compare Url's with System.Uri
@YaronNaveh
When you need to compare two Url's never trust on simple string comparison. Always use a comparison that takes semantics into consideration. In C#, System.Uri can be used. Check the below:
string url1 = "http://www.site.com/dir/index.html";
string url2 = "http://www.site.com/dir/dir1/../index.html";
url1 == url2; //false
new Uri(url1).Equals(url2); //true
And another one:
string url1 = "http://www.site.com/index.html?q=1 2";
string url2 = "http://www.site.com/index.html?q=1%202";
url1 == url2; //false
new Uri(url1).Equals(url2); //true
@YaronNaveh
What's next?
get this blog
rss updates
or register for
mail updates!
0 comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Subscribe in a reader
@YaronNaveh
or enter your mail:
About Me
Yaron Naveh (MVP)
Israel
I am a software architect & developer. I write on node.js, backbone.js, mongodb, web services security and wcf.
Mail me
or tweet me
(@YaronNaveh)
View my complete profile
Blog Archive
►
2015
(3)
►
July
(1)
►
April
(1)
►
January
(1)
►
2014
(3)
►
June
(1)
►
May
(1)
►
January
(1)
►
2013
(3)
►
December
(1)
►
June
(1)
►
March
(1)
►
2012
(23)
►
October
(4)
►
September
(1)
►
July
(1)
►
June
(4)
►
May
(4)
►
April
(6)
►
March
(2)
►
February
(1)
►
2011
(17)
►
July
(1)
►
June
(2)
►
May
(3)
►
April
(2)
►
February
(6)
►
January
(3)
▼
2010
(73)
►
December
(4)
►
November
(3)
►
October
(7)
►
September
(10)
►
August
(3)
►
July
(5)
►
June
(5)
▼
April
(4)
Interoperability Gotcha: OAEP Parameterization is ...
Wcf first connection is slow
Quiz #2 - The answer (goto in c#)
Remember to compare Url's with System.Uri
►
March
(10)
►
February
(11)
►
January
(11)
►
2009
(38)
►
December
(5)
►
November
(2)
►
August
(1)
►
July
(5)
►
June
(8)
►
April
(7)
►
March
(4)
►
February
(1)
►
January
(5)
►
2008
(19)
►
November
(5)
►
October
(14)
Powered by
Blogger
.
0 comments:
Post a Comment