Help with WebRequest Authentication

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bruno

    #1

    Help with WebRequest Authentication

    Hello friends

    I'm developing a app o send xml data to a web server using HTTP POST.To do
    that Im using the WebRequest VB class. I can send the data sucessfully to the
    web server, using:

    Dim req As WebRequest
    req =
    WebRequest.Crea te("http://localhost/SendAndReceiveD ataWebPages/PassText.aspx")
    req.Method = "POST"
    Dim sw As New StreamWriter(re q.GetRequestStr eam())

    sw.WriteLine("H ere goes te text to pass")
    sw.Close()
    rsp = req.GetResponse ()
    ......
    ....

    but now I need to use Basic Authentication with username/password encoded on
    my connection. Can anyone help me how can I do that, because I don't know how
    can I do that.

    Thank you for help
    Bruno
  • Herfried K. Wagner [MVP]

    #2
    Re: Help with WebRequest Authentication

    "Bruno" <Bruno@discussi ons.microsoft.c om> schrieb:[color=blue]
    > I'm developing a app o send xml data to a web server using HTTP POST.To do
    > that Im using the WebRequest VB class. I can send the data sucessfully to
    > the
    > web server, using:
    >
    > Dim req As WebRequest
    > req =
    > WebRequest.Crea te("http://localhost/SendAndReceiveD ataWebPages/PassText.aspx")
    > req.Method = "POST"
    > Dim sw As New StreamWriter(re q.GetRequestStr eam())
    >
    > sw.WriteLine("H ere goes te text to pass")
    > sw.Close()
    > rsp = req.GetResponse ()
    > .....
    > ...
    >
    > but now I need to use Basic Authentication with username/password encoded
    > on
    > my connection.[/color]

    Maybe you can use the techniques described here:

    <URL:http://dotnet.mvps.org/dotnet/code/net/#CookieRequest>

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

    Comment

    Working...