Retrieve asp.net session variable within HTA page?

K

Kathy Burke

Hello.

I have an aspx page with a button onclick that opens an HTA page that
simply runs javascript to open a client desktop application...the aspx
form remains open.

I would like to set which file should be opened by the HTA based on a
session variable set in the aspx page.

Having a total brain-fade on this. Tried the following in the HTA with
no luck:

<html>
<%@language="vbscript"%>
<%= session.getAttribute( "KB_Test" ) %>
<head>
<title>Session Test</title>
<HTA:APPLICATION ID="oHTA"/>
</head>
<body>
<p>Test: <%=KB_Test%></p>
</body>
</html>

Please, what am I missing...other than a piece of my brain?

Thanks,
Kathy
 
J

Jason S

Kathy,

Not sure where the .getAttribute method comes from... could this be your
problem?

Regards,
Jason S.
 
K

Kathy Burke

Just trying things from examples I've seen.

Then I thought, it would be easier just to pass a querystring to the
hta form -- but this doesn't seem to work?

My asp.net is:

Dim strTest As String = "Hello Kathy"
RegisterClientScriptBlock("Test",
"<script>window.open('TEST.hta?filename= ' + strTest', 'Test',
'menubar=no');</script>")

My hta is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<%@language="vbscript"%>
<%= varFilename=request.querystring("filename") %>
<head>
<title>Session Test</title>
<HTA:APPLICATION ID="oHTA"/>
</head>
<body>
<p>Test: <%= varFilename %></p>
</body>
</html>

But I don't see the querystring variable...?

Clues?

Thanks,

Kathy
 
J

Jason S

Been awhile since I read about HTA's. I wouldn't have commented in the
first place except I saw what looked like a bad method call. Read as much
as you can about HTA's on MSDN... not sure if they honor querystrings or how
you pass parameters to them.

Jason S.
 
J

Joe

Been a bit since I've used HTAs too but I think Jason's right about the
request.querystring. As far as I remember, HTA's execute client-side
vbscript and jscript.

I know it would be a pain in the nether region but maybe you'll have to
generate the hta dynamically and save it on the server before opening it
using whatever class corresponds in asp.net to the old filesystem object in
classic asp, probably system.io.

If it's an intranet situation and you want to open an M$ Office program I've
used automation successfully to open Word and enter info from a database on
the server in the new document. It's no great leap to do the same kind of
thing with Excel or Access.

Just my penny's worth - it's an interesting question.

Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top