473,322 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

webrequest and authentication problem

Dear ASP.NET Programmers,

Please consider the intranet site with the following forms authentication
page http://localhost/database/login.aspx. The usernames and passwords are
stored in the SQL Server database. After authenticating, the users are be
able to save the generated documents (HTML output of the generated document)
when they click on a button in http://localhost/database/medicalDocs/1.aspx.
I use the following code:

Dim wReq As WebRequest
Dim wResp As WebResponse
Dim srData As StreamReader
Dim fsDest As FileStream
Dim wrStream As StreamWriter
Dim buffer(1024) As Char
Dim intBytes As Integer
Dim strData As String

fsDest = New FileStream("d:\Downloads\doc.htm",
FileMode.OpenOrCreate, FileAccess.Write)
wrStream = New StreamWriter(fsDest)
wReq =
WebRequest.Create("http://localhost/database/medicalDocs/1.aspx")
wResp = wReq.GetResponse
srData = New StreamReader(wResp.GetResponseStream,
System.Text.Encoding.ASCII)
intBytes = srData.Read(buffer, 0, 1024)
Do While (intBytes > 0)
wrStream.Write(buffer, 0, intBytes)
intBytes = srData.Read(buffer, 0, 1024)
Loop
wrStream.Close()
srData.Close()
fsDest.Close()

but the saved document is the login page
(http://localhost/database/login.aspx) instead of the
http://localhost/database/medicalDocs/1.aspx. How can I supply the login
information with the WebRequest object or how can I work around it? Thanks
in advance,
Nov 20 '05 #1
0 1156

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: James Johnson | last post by:
Dear C#dex, I define a variable: HttpWebRequest webRequest and run the following request webRequest = WebRequest.Create(TARGET_URL) as HttpWebRequest; The webRequest object returns values...
5
by: Tony | last post by:
Please help, I've scoured the web but cannot find an answer to this! I want to use WebRequest to get the contents of a web page. The trouble is, the page require you to go to a login page (using...
2
by: TheBurgerMan | last post by:
Hi all. I need to attach NetworkCredentials to a WebRequest and display the resulting web page in an IFRAME (aspx). I have validated that I can get the page (using the NetworkCredentials), but...
2
by: Stephen Miller | last post by:
I have an ASPX report and I want to capture the rendered HTML and write to a file on the webserver. Several posts suggest using WebRequest to make a second call to the page, and screen-scrape the...
8
by: John K. | last post by:
Hi I was wondering if it's possible to use the WebRequest class to access a file on windows shared folder with authentication? If yes, what would the syntax be? I've tried to look this up in the...
4
by: Terry | last post by:
Hello, I am trying to get a response for an .aspx page in my current project (same virtual directory) by using WebRequest.GetResponse but I keep getting a exception with "500 Internal server...
0
by: IronYuppie | last post by:
Hi all-- I'm retrieving contents from my site using the retrieving images from the database method listed here: ...
2
by: davidcbrown | last post by:
I started using .NET 2003 and my first application is to parse an HTML form. But I am behind an ISA firewall and get "(407) Proxy Authentication Required" with the following code. The proxy...
1
by: Bruno | last post by:
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.