GoofyDawg
asked on
Out of curiosity... Anybody using ASP and XMLHTTPRequest?
Just out of curiosity, I was wondering if anyone has deployed any applications using good ol' ASP and XMLHTTPRequest. I've started doing it with a couple of sites I'm working on, and am finding it's amazingly fast and starts introducing the concept of an "application" to the web without all the overhead of let's say a Java-based framework like AF, or even the sophistication of Ruby on Rails.
Points will be awarded based on discussion and good, working examples.
Thanks!
GoofyDawg
Points will be awarded based on discussion and good, working examples.
Thanks!
GoofyDawg
ASKER
That's cool, but I'm actually looking for created on a broader scale - perhaps some web application that was built using XMLHTTPRequest - Mind you - and I'm sorry I didn't mention this - I'm looking for something cross-browser as well...
GoofyDawg
GoofyDawg
Perhaps you should be more specific since 'web application' is vague. Also, that's not cross-browser. Test for the support and then branch, as you would with any app.
ASKER
Hmm...
I hate to use the buzz word of the day, but to be specific, I'm essentially talking about AJAX. I'm looking to see if anyone has done something along these lines using ASP, such as a dedicated (and I'll correct myself here) web-based application using ASP as the "app" layer, then JavaScript/XMLHTTPRequest to handle the content.
Thanks for the input so far...
GoofyDawg
I hate to use the buzz word of the day, but to be specific, I'm essentially talking about AJAX. I'm looking to see if anyone has done something along these lines using ASP, such as a dedicated (and I'll correct myself here) web-based application using ASP as the "app" layer, then JavaScript/XMLHTTPRequest to handle the content.
Thanks for the input so far...
GoofyDawg
For the record and as has been pointed out already you should be using ServerXMLHTTP instead of XMLHTTPRequest
GD...
I haven't done any 'ajax' per se and I know it's the buzz word of the day but it's not anything new. MSFT was doing it years ago. It's called remote scripting. I have an article somewhere. In fact, I believe I already posted a link to it here on a different question.
Here, I found it. You should read this article. It's not only accurate and informative, it's quite humorous.
http://www.eggheadcafe.com/articles/20050528.asp
The idea is to add/update elements into your page without refreshing. It still uses the HTTPRequest but MSFT one way and FF (for example) uses it with what is built in. Since IE doesn't have it built-in, the ActiveX is required. FF couldn't use the ActiveX, even if it didn't have support built-in because FF doesn't support ActiveX. That was my reference to my previous comment re: Test for support and then branch meaning test for what the browser supports vs testing for the browser name and version and then branch accordingly in your app.
This was the other thread. You may find it useful.
http:Q_21476930.html
I haven't done any 'ajax' per se and I know it's the buzz word of the day but it's not anything new. MSFT was doing it years ago. It's called remote scripting. I have an article somewhere. In fact, I believe I already posted a link to it here on a different question.
Here, I found it. You should read this article. It's not only accurate and informative, it's quite humorous.
http://www.eggheadcafe.com/articles/20050528.asp
The idea is to add/update elements into your page without refreshing. It still uses the HTTPRequest but MSFT one way and FF (for example) uses it with what is built in. Since IE doesn't have it built-in, the ActiveX is required. FF couldn't use the ActiveX, even if it didn't have support built-in because FF doesn't support ActiveX. That was my reference to my previous comment re: Test for support and then branch meaning test for what the browser supports vs testing for the browser name and version and then branch accordingly in your app.
This was the other thread. You may find it useful.
http:Q_21476930.html
ASKER
That article is dead-on. Thanks for the reference. Just for clarity, I'm not new to remote scripting, but the funny thing is that up until recently, I hadn't heard of a lot of sites that were employing it to a very large degree, so I was curious to see if people were actually using it - especially with basic ASP. Now there seems to be this craze over it, especially in the non-MSFT platforms.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
What I've personally found is that your client (or whoever you're building for) has to accept the fact that changing content will not cause a page refresh - goes back to that notion of an application. I had a lot of explaining to do recently with a client when I rebuilt the content management section of their site. They kept on saying "it's on the same page!" :)
With regards to you last statement, what I found easiest was to use my ASP pages simply as content providers, and letting JavaScript and CSS handle display. But you're right, with AJAX, you do introduce another layer, so it can be a bit challenging.
GoofyDawg
With regards to you last statement, what I found easiest was to use my ASP pages simply as content providers, and letting JavaScript and CSS handle display. But you're right, with AJAX, you do introduce another layer, so it can be a bit challenging.
GoofyDawg
Thank you GD.
ASKER
Not a problem. Thanks for the discussion.
This is the link: (notice you cannot view the source)
http://kiddanger.com/lab/getimage.asp
This is the source code:
<%@ Language=VBScript %>
<%
function GetBinaryData(filename)
Response.ContentType = "image/gif"
dim HTTP
set HTTP = Server.CreateObject("MSXML
HTTP.Open "GET", filename
HTTP.Send
GetBinaryData = HTTP.responseBody
set HTTP = nothing
end function
sub SaveBinaryFile(binaryData,
dim fso, bStream
set fso = server.CreateObject("Scrip
set bStream = server.CreateObject("ADODB
bStream.Type = adTypeBinary
bStream.Open
bStream.Write binaryData
if not fso.fileExists(path) then
bStream.SaveToFile path, adSaveCreateNotExist
else
bStream.SaveToFile path, adSaveCreateOverWrite
end if
bStream.Close
set bStream = nothing
set fso = nothing
End sub
Function ReadBinaryFile(FileName)
Const adTypeBinary = 1
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream
BinaryStream.Type = adTypeBinary
BinaryStream.Open
BinaryStream.LoadFromFile FileName
ReadBinaryFile = BinaryStream.Read
End Function
Const strPath = "c:\domains\kiddanger.com\
dim path, gifdata, file, remoteFile, imgdata
remoteFile = "http://www.google.com/intl/en/images/logo.gif"
imgdata = GetBinaryData(remoteFile)
file = "logo.gif"
path = strPath & file
SaveBinaryFile imgdata, path
gifdata = ReadBinaryFile(path)
Response.ContentType = "image/gif"
Response.Buffer = True
Response.Clear
Response.BinaryWrite gifdata
Response.Flush
%>
This is a link to grab a local (server) file and display it in a textarea. There is a link at the bottom of the page to view the source.
http://kiddanger.com/lab/geturl2.asp
This is the file it grabs:
http://kiddanger.com/lab/plainjane.html
You can view the source to see it is an HTML file but the HTML markup is stripped when it is called from geturl2.asp.