Link to home
Start Free TrialLog in
Avatar of neilbarton
neilbarton

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of cj_nepenthe
cj_nepenthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of neilbarton
neilbarton

ASKER

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
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
This is also MSIE-only.

The simpler and better solution is to use the .asp extension and a server-side include.
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" -->
Cheers found the answer.

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