Connecting Tech Pros Worldwide Help | Site Map

Question about using : in URL

  #1  
Old November 21st, 2008, 02:55 AM
Anthony P.
Guest
 
Posts: n/a
Hello Everyone,

I'm using an URI object and I need to pass the url as follows:

http://ausername:apassword@example.com

The problem is that when VB.NET encounters the colon in the URL it
thinks it's a port and can't parse it. Is there a better way to pass
these credentials or, if not, how can I get around this?

Thanks!
  #2  
Old November 21st, 2008, 09:15 AM
kimiraikkonen
Guest
 
Posts: n/a

re: Question about using : in URL


On Nov 21, 4:54*am, "Anthony P." <papill...@gmail.comwrote:
Quote:
Hello Everyone,
>
I'm using an URI object and I need to pass the url as follows:
>
http://ausername:apassw...@example.com
>
The problem is that when VB.NET encounters the colon in the URL it
thinks it's a port and can't parse it. Is there a better way to pass
these credentials or, if not, how can I get around this?
>
Thanks!
Hi,
You can try to initialize a NetworkCredential object and pass
username, password and domain in its constructor as
follows:

Imports System.Net
Dim nc As New NetworkCredential("user","pass","domain")

http://msdn.microsoft.com/en-us/libr...redential.aspx
http://msdn.microsoft.com/en-us/libr...roperties.aspx

Hope this helps,

Onur Güzel
  #3  
Old November 21st, 2008, 11:25 PM
Herfried K. Wagner [MVP]
Guest
 
Posts: n/a

re: Question about using : in URL


"Anthony P." <papillion@gmail.comschrieb:
Quote:
I'm using an URI object and I need to pass the url as follows:
>
http://ausername:apassword@example.com
>
The problem is that when VB.NET encounters the colon in the URL it
thinks it's a port and can't parse it. Is there a better way to pass
these credentials or, if not, how can I get around this?
As mentioned in the other post, use 'NetworkCredentials' instead. Note that
the above URI is actually /not/ a valid HTTP URI because HTTP URIs must not
contain credentials like FTP URIs, for example. Only some browsers support
credentials as part of HTTP URIs (this dangerous "feature" has been dropped
from IE some years ago).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
simple Question about using BeautifulSoup Alexnb answers 2 August 20th, 2008 03:45 PM
Question about 'Using' and resources mg answers 10 September 2nd, 2006 03:25 AM
Question about using namespace std Schizoid Man answers 3 August 23rd, 2006 11:55 PM
Question about using delegates with a string paramater to return a ListViewItem object... Max Adams answers 2 November 16th, 2005 09:52 AM