views:

77

answers:

2

Hi,

I have a classic asp page which has, encapsulated within it in an iframe, is a .net ajax control. This all works fine. However, what I need to do is if a button is clicked in the .net control I need a session variable on my classic asp page to be updated. So I guess, simply put, how do I pass a variable from a .net page to a classic asp page?

I have read some stuff about putting the vars to be passed in the query string but this wont work (I think) because the when the ajax control updates it doesn't refresh the encapsulating page.

Could I use an intermediary page? From within my ajax control can I call another classic asp page, and then use some code in that to update the var? The intermediary page would never be displayed.

Thanks, R.

+2  A: 

Hi!

One option would be to refresh your main ASP page from within your .net ajax control using:

parent.document.location.href = 'mypage.asp?session_parameter=new_value';

Inside your ASP page you would need to upload the session using the 'session_parameter' variable. It's not the best way since it would cause a complete refresh of your page but it updates your session variable instantly.

But as you mentioned, I would prefer to make an asynchronous javascript call to some intermediary ASP page that would refresh the session as needed. You could achieve this using the XMLHttpRequest object.

jdecuyper
That's pretty awesome, thanks :)
flavour404
+2  A: 

To be able to share a session variables in both the ASP.NET and the classic ASP site you need to make your asp.net session "readable" for the classic asp app. This article describes how.

Colin
Thanks, i'll have a read.
flavour404