For Programmers: Free Programming Magazines  


Home > Archive > C# > September 2005 > How to use the UriBuilder ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to use the UriBuilder ?
LarsDahl

2005-09-19, 5:17 am

I've run into a problem using the UriBuilder:
I can set the Fragment property. (you know the #label part.) It works fine.
I can set the Query property. (you know the ?key1=value1&key2=value2 part.) It works fine.
... but ...
When I set both the Fragment property and the Query property, it do not include the fragment part in the uri.
When I set both the Query property and the Fragment property, it do not include the query part in the uri.

So ... How do I get both to work with the UriBuilder?
LarsDahl

2005-09-19, 9:57 am

Read documentation??? How quaint!

From http://msdn.microsoft.com/library/e...squerytopic.asp
Setting the Query property to any value, including a null reference (Nothing in Visual Basic), clears the Fragment property.

From http://msdn.microsoft.com/library/e...agmenttopic.asp
Setting the Fragment property to any value, including a null reference (Nothing in Visual Basic), clears the Query property.

Yeah... Ok... I see the problem... Guess that I have to continue my workaround.

UriBuilder test = new UriBuilder("http://server.name/default.aspx?key1=value1&key2=value2#label");
then
test.Uri.ToString()
give:
http://server.name/default.aspx#lab...ue1&key2=value2

So both can be set, but I feel it is a bit clumsy way to do it...
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com