Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > How to authenticate HttpWebRequest?

Thread Tools

How to authenticate HttpWebRequest?

Posts: n/a

i have a protected part of application ("security" subdirectory is
protected by authentication mode="Forms").
i'd like to give a user a option to printfriendly version of content a page
in this directory.
in my printfriendly script i try to get a content of a page and then with
RegEx object to filter this content:
Dim URL as String = "http://myserver/security/test.aspx"
Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create(URL), _
' Sends the request and waits for a response.
Dim myHttpWebResponse As HttpWebResponse = _
CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
Dim receiveStream As Stream = myHttpWebResponse.GetResponseStream()
Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
' Pipes the response stream to a higher level stream reader with the
' required encoding format.
Dim readStream As New StreamReader(receiveStream, encode)
Dim myHTML As String
myHTML = readStream.ReadToEnd
when i try to get the html code in not protected directory everything works
fine, but in security directory this myHttpWebRequest is probably not
authenticated and i get only my login page... i don't know why
myHttpWebRequest is not authenticated, i try to start this request in
security part, so after login, it should be authenticated.

have you any ideas to solve this problem?
thanks a lot.
Reply With Quote

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
authenticate as guest when computer or user information is unavailable Graham Turner Wireless Networking 5 03-14-2005 09:42 PM
PIX 515E and Windows 2003 CA authenticate problem Torsten Stier Cisco 3 05-26-2004 09:38 AM
Re: PIX 525 does not authenticate Windows 2000 CA Richard Sanderson Cisco 1 01-22-2004 02:43 PM
Using Cisco ACS to authenticate against LDAP through SSL Silvio Arcangeli Cisco 0 10-20-2003 11:08 AM