HighTechTalks DotNet Forums  

open a htaccess-secured url

Dotnet VJSharp microsoft.public.dotnet.vjsharp


Discuss open a htaccess-secured url in the Dotnet VJSharp forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Oliver Neumann
 
Posts: n/a

Default open a htaccess-secured url - 08-23-2004 , 03:29 PM






Hello,

can somebody tell me how i can open a site who is secured by htaccess ? I
created the url and the urlconnection but i dont know how i could enter the
password and username for the access.


Any help is appreciated...

thanks!
Oliver



Reply With Quote
  #2  
Old   
Oliver Neumann
 
Posts: n/a

Default Re: open a htaccess-secured url - 09-01-2004 , 03:14 AM






Thanks Lars but i already figured our by myself with help of tutorials.


later,
oliver


"Lars-Inge Tønnessen [VJ# MVP]" <http://emailme.larsinge.com> schrieb im
Newsbeitrag news:erVK7RpiEHA.1356 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
Quote:
You have to use a credential with the user name and password. I have
written
an example for you. I assume your apache is using "AuthType Basic" auth in
the .htpasswd file


public class Class1
{
public Class1()
{
System.Console.WriteLine("Connecting to http://10.0.0.2/test");
System.Net.WebClient client = new System.Net.WebClient();
System.Net.NetworkCredential credenal = new
System.Net.NetworkCredential("username", "password");
client.set_Credentials( credenal );
System.IO.Stream stream = client.OpenRead( "http://10.0.0.2/test" );

System.IO.StreamReader txt = new System.IO.StreamReader( stream );
String line;
while ( (line = txt.ReadLine()) != null )
System.Console.WriteLine( line );

stream.Close();

}

/** @attribute System.STAThread() */
public static void main(String[] args)
{
new Class1();
}
}



Regards,
Lars-Inge Tønnessen
www.larsinge.com





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.