Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Is it possible to load an asp page externally from html?

Posted on 2003-11-20
6
Medium Priority
?
216 Views
Last Modified: 2010-04-09
Is it possible to request an asp page to be ran from inside HTML?  

I have an asp page that loads data into an sql database, and I want this information inserted when visitors view my pages but some of the pages are HTML.  

I don't want any contents from the asp page to be shown.

Would this be possible with Javascript?

Thanks in advance

Neil
0
Comment
Question by:neilbarton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 1

Accepted Solution

by:
cj_nepenthe earned 500 total points
ID: 9789217
Hi,

Yes, this is possible using something similar to the script below.  This triggers an HTTP call to your ASP page whenever the page is loaded.

<script>
function insertData() {
   var objHttp = new ActiveXObject("Msxml2.XMLHTTP");
   objHttp.open("get", "http://myserver/insert-data.asp", false);
   objHttp.send();
   // (error checking goes here)
}
</script>

<body onload="insertData()">

0
 

Author Comment

by:neilbarton
ID: 9789345
Thanks for the quick response.  

The problem I am having is that on the html page I also have an external .js file which picks up some of the user details and saves them as cookies.  

Then when the ASP code is ran it should retreive some of the data from the cookies and some other from the sessions variables.   When the ASP loads it stores only the data from the sessional variable and leaves the fields from cookies empty even though I know that the cookies are there with data inside.

The code I am using to to grab the information from the cookies, seems not to work:

  objRS("Title") = Request.Cookies("Title")

The code I am using to grab information from the Session variables, works:

  objRS("UID") = Session("UID")

Is it possible to request cookies when loading a page using objHttp:open or <img src="thepage.asp" >.

Neil
0
 
LVL 1

Expert Comment

by:cj_nepenthe
ID: 9789527
That could be a problem, I don't think XMLHTTP sends the cookie data in the headers, because the request doesn't come directly from the browser.  It could also be a bit of a security hole.

Your best bet might be to get your cookie data using client-script from document.cookie, then pass it in parameters to your ASP page.

There are some handy client-side cookie manipulation routines here:
http://www.webreference.com/js/column8/functions.html
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 11

Expert Comment

by:Zontar
ID: 9789897
This is also MSIE-only.

The simpler and better solution is to use the .asp extension and a server-side include.
0
 
LVL 1

Expert Comment

by:cj_nepenthe
ID: 9790247
Server-side includes would be a much better solution if your server supports it, which it should if you're running ASP.
Unfortunately, you can only use SSI in .asp pages by default, so it might not work.  An .htm page process the SSI directives unless you play around with your web server settings.

But if you want to give it try, stick something like this at the top of your file and see what happens!

<!-- #include file="insert-data.asp" -->
0
 

Author Comment

by:neilbarton
ID: 9798903
Cheers found the answer.

<script>
  newImg = new Image();
  newImg.src = "http://myserver/insert-data.asp?quesr&string=parameter"+other.objectsValues+document.cookie;
</script>
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question