On CBS.com: U2 on Late Show with David Letterman

Manipulate URIs with Visual Studio .NET's System.URI class

Tags: Microsoft development tools, .NET, Irina Medvinskaya, Uniform Resource Identifier, strURI, ListBox1, Microsoft Visual Studio, Microsoft Visual Studio.Net, Visual Basic Tips Newsletter

  • Save
  • Print
  • Recommend
  • 4

Takeaway: Irina Medvinskaya explains how you use Visual Studio .NET's System.URI class to work with Uniform Resource Identifiers (URIs). This class allows you to represent and easily manipulate a given URI.

Uniform Resource Identifiers (URIs) may represent Web requests, FTP requests, files, news, and e-mail. Whenever you need to work with URIs and determine a particular portion of a given URI, you can utilize the System.URI class available in Visual Studio .NET. This class allows you to represent and easily manipulate a given URI.

To create an example, add a ListBox control to your form and call it ListBox1. Then, add the code in Listing A. The result of running this code looks like Figure 1.

In the code, I initially define a strURI variable and set its value to a link from the TechRepublic site. Then, I add the following properties of the URI object strURI to the ListBox1 control: Scheme, Host, Path, Query, Type, Port. The ListBox1 control simply displays the selected properties of the strURI object.

Miss a tip?

Check out the Visual Basic archive, and catch up on the most recent editions of Irina Medvinskaya's column.

Advance your scripting skills to the next level with TechRepublic's free Visual Basic newsletter, delivered each Friday. Automatically sign up today!

  • Save
  • Print
  • Recommend
  • 4

Print/View all Posts Comments on this article

VB BALTHOR | 01/10/07
Didn't really seem worth the effort did it Tony Hopkinson | 01/10/07

What do you think?

White Papers, Webcasts, and Downloads

Article Categories

Security
Security Solutions, IT Locksmith
Networking and Communications
E-mail Administration NetNote, Cisco Routers and Switches
CIO and IT Management
Project Management, CIO Issues, Strategies that Scale
Desktops, Laptops & OS
Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
Data Management
Oracle, SQL Server
Servers
Windows NT, Linux NetNote, Windows Server 2003
Career Development
Geek Trivia
Software/Web Development
Web Development Zone, Visual Basic, .NET

SmartPlanet

advertisement
Click Here