C sharp - WebRequest

 
Vista:

WebRequest

Publicado por miri (2 intervenciones) el 09/11/2005 12:09:00
Estoy realizando una aplicaion en c# . net y tengo que realizar la autenticacion xo no se si seria correcto utilizar el WebRequest o no. Si alguien sabe como ayudarme y sabe mas o menos como funciona el WebRequest que me lo explique.
Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 158
Bronce
Ha disminuido 1 puesto en C sharp (en relación al último mes)
Gráfica de C sharp

RE:WebRequest

Publicado por Yamil Bracho (1164 intervenciones) el 12/11/2005 16:50:39
Si la autenticacion la estas haciendo contra alguna pagina, pues es lo correcto. De todas maneras creo que es mejor idea que la autenticacion la manejes como un webservice. En el MSDN tienes un ejemplo pero igual te lo dejo aqui

// Create a new webrequest to the mentioned URL.
WebRequest myWebRequest=WebRequest.Create(url);

// Set 'Preauthenticate' property to true. Credentials will be sent with the request.
myWebRequest.PreAuthenticate=true;

Console.WriteLine("\nPlease Enter ur credentials for the requested Url");
Console.WriteLine("UserName");
string UserName=Console.ReadLine();
Console.WriteLine("Password");
string Password=Console.ReadLine();

// Create a New 'NetworkCredential' object.
NetworkCredential networkCredential=new NetworkCredential(UserName,Password);

// Associate the 'NetworkCredential' object with the 'WebRequest' object.
myWebRequest.Credentials=networkCredential;

// Assign the response object of 'WebRequest' to a 'WebResponse' variable.
WebResponse myWebResponse=myWebRequest.GetResponse();

[C++]
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar