Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.Net MSXML Alternative

Status
Not open for further replies.

chrigil

Programmer
Sep 23, 2003
178
GB
Can anyone enlighten me as to an alternative to using the MSXML dll for the following task.

I need to loop through all the records in a recordset (about 50) and for each one request an ASP page using the MSXML2.ServerXMLHTTP object. I then need to get the raw HTML from these pages (each one is 2-3Kb) and then write it to a new textfile in a folder.
In theory this is as easy as MSXML2.ServerXMLHTTP --> FileSystemObject --> Hey Presto the file is written. Unfortunately the MSXML dll is timing out after only 4-5 files being written.

Is there a way i could acheive the same end result using pure ASP.Net and bypassing the MSXML? I'm a 'classic' ASP programmer so I don't have much experience with .Net but any advice will be an advance on my current position.

Thanks in advance,

Chris Gilbert.
 
just a clarification if i may,
you want to read the recordset then create an asp page for each record read then read the raw html?

what are you trying to achieve from creating the asp pages then only getting the raw html?



Note:Copying and Pasting is NoT Creativity.
What would you attempt to accomplish if you knew you would not fail?
 
I'm not creating the ASP page and then reading the html I'm requesting an ASP page and reading the resulting output html.

The same ASP page is requested but with different arguments each time, thus resulting in different HTML as it's output. It's for a menu system that uses a lot of recordsets. Instead of having all these recordsets run eachtime someone loads a page we have used static includes for the menu system that are automatically created whenever an administratot adds/adits or deletes a menu item. This results in the recordsets only being run about once a month rather than 1000 times a day.
 
in this case you can use StreamReader to read any file and output the results.
below is function i used in a User Control to read any file and output it
another idea is to replace the static includes with user controls and cache tem in the pages. this way they will only be re generated by the server if a change has been made


Code:
Function GetFileContents(ByVal FileToRead As String) As String
        Dim objFile As System.IO.File
        Dim objStreamReader As System.IO.StreamReader

        objStreamReader = objFile.OpenText(Server.MapPath(FileToRead))
        GetFileContents = Server.HtmlEncode(objStreamReader.ReadToEnd())
        objStreamReader.Close()
    End Function

hope that helps
Good luck


Good luck


Note:Copying and Pasting is NoT Creativity.
What would you attempt to accomplish if you knew you would not fail?
 
Hi, thanks for the info, this should be really heplful.

Unfortunately I haven't taken the leap into ASP.Net yet so I don't really understand the bit about user controls. The function is fairly self explanatory and i'll be able to implement that no problem.
What exactly is a user control and how does it work? I don't want to waste you time asking for a full personalised tutorial ;) but you seem to know what your on about.



Thanks in advance,

Chris
 
I have implemented the above Function and gotten the result written to a text file but unfortunately it is only returning the URL Encoded page. I understand why but it isn't what I want.
I want the result of the processed ASP page rather than the text. For example for an asp page containing:

response.write(now())

I want the result to be:

26/10/2004 15:38:24

and not:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%

response.write(now())

%>

Is this possible or not?



Thanks in advance,

Chris
 
Chrigil,
sorry for the delay, i havent had any chance to be online for awhile due to deadlines.

I's too late now but i think i know what you are looking for and in order to display the pages as is you will need to use the System.Net.HttpWebRequest Class.

take a look at these links


hope that helps

Good luck


Note:Copying and Pasting is NoT Creativity.
What would you attempt to accomplish if you knew you would not fail?
 
Thanks Ecreations that's exactly what I was looking for,



Thanks in advance,

Chris
 
pleasure and hope that helps resolving the issue with your app

Good luck


Note:Copying and Pasting is NoT Creativity.
What would you attempt to accomplish if you knew you would not fail?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top