Forum Moderators: open
My question is regarding this thread:
[webmasterworld.com...]
I do not have access to the machine.config file so making alterations there is out of the question. My problem is I have generated an .aspx page that I would like to call from html.
Basically I would like the page to execute the aspx script, then return and generate the remaining html. It doesn't however it executes the aspx page but halts execution at the script tag in the html resulting in a blank page. I can place the script tag at the end of the page but I would prefer not to do this.
any help is appreciated.
Rich
html
---------------
<HTML>
<HEAD>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<TITLE>The Widgetsville Riverside Retreat title goes here.</TITLE>
<Meta name="description" content="The Widgetsville Riverside Retreat description goes here.">
<LINK rel="stylesheet" type="text/css" href="./misc/styles.css">
<script language="JavaScript" src="counterupdate.aspx" />
</HEAD>
...
-----------------------
[edited by: Woz at 7:50 am (utc) on Feb. 3, 2003]
[edit reason] no specifics please [/edit]
<HTML>
<HEAD>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<TITLE>The Widgetsville Riverside Retreat title goes here.</TITLE>
<Meta name="description" content="The Widgetsville Riverside Retreat description goes here.">
<LINK rel="stylesheet" type="text/css" href="./misc/styles.css">
</HEAD>
<BODY>
<script language="JavaScript" src="counterupdate.aspx" />
....
Here's what I'm trying to achieve maybe there's another way:
--------------------------------
I am trying to trace visitors through the web site, I do so by logging each page visited into a database. This functionality is encapsulated into an object called StatTracer which I store in the session.
Currently there's a httpmodule installed that intercepts all aspx requests and calls the update method on the StatTracer to add another entry to the database.
It works great for aspx pages but I would really like a way to intercept html requests and call the StatTracer asp .net object. My understanding is that we cannot do this with IIS 5.0, though we will be able to with .NET Server. So in the interim I thought I could use the javascript technique to access a remote aspx page that employs the same behaviour as the httpmodule, this would work for selected html pages which would be fine for now.
--------------------------------
thanks for any more help on this...
code follows:
<<File Index.htm >>
...
<BODY background="images/bg_cross.gif" leftmargin="0px" rightmargin="10" topmargin="0">
<script language="JavaScript" src="counterupdate2.aspx" />
...rest of page
<<File: counterupdate2.aspx >>
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="RichardGilling.StatTracer" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.SessionState" %>
<script runat="server" language="C#">
private void Page_Load(object sender, System.EventArgs e)
{
Update();
}
private void Update()
{
HttpContext ctx = HttpContext.Current;
OleDbStatTracer stats;
ctx.Trace.Write("CounterUpdate: Started");
if (ctx.Session!= null)
{
ctx.Trace.Write("CounterUpdate: Loaded Session");
stats = (OleDbStatTracer) ctx.Session["StTrace"];
if (stats == null)
{
//create StatTracer
stats = new OleDbStatTracer();
//store in session
ctx.Session.Add("StTrace", stats);
ctx.Trace.Write("CounterUpdate: Created New StatTracer");
}
//get string to add
System.Uri url = ctx.Request.UrlReferrer; //referrer code
Uri host = new Uri(url.GetLeftPart(UriPartial.Authority));
//extract relative location from host name
int len = host.ToString().Length;
string page = url.ToString().Substring(len).ToLower();
ctx.Trace.Write("CounterUpdate: About to add page " + page);
//update page tracer
stats.update(page);
}
}
</script>