473,625 Members | 3,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieve session var from .net page and use in VBScript

Can I do this?

I add a session var in C# and ultimatly want to pass it into a vbscript
client side activeX control. This is what I have so far but get " Object
Required:'name2 ' " error.

Can anyone suggest a btter way of passing a session var into a vbscript
function?

<%@ Page language="c#" debug="true" ContentType="te xt/html"
ResponseEncodin g="iso-8859-1" %>
<script runat="server">
void Page_Load()
{
if(Page.IsPostB ack)
{

}
else
{
//get name from TextBox
string myVar =name.Value;

//add name to session
Session.Add("se ssionVar1", myVar);

//store session var in a hidden input so it can be retrieved from
VBScript
string retrievedSessio nVar=(string) Session["sessionVar 1"];

//show that var was retrieved successfully
HiddenInput1.Va lue = retrievedSessio nVar;
}
}
</script>

<script language="vbscr ipt">

private sub fill(HiddenInpu t1)
dim Name
Name = HiddenInput1.va lue
retrieve(Name)
end sub

private sub retrieve(Name)
name2.value=Nam e
end sub

</script>
<html>
<head>
<title>Test</title>

</head>
<body>
<form>
<p>
<input type="text" ID="name" Value="Frank" runat="server">
simply stores and shows the session var value </p>
<p><br>
<input type="text" ID="name2" name="name2">
This is the box that should display the session var via the vbscript
</p>
<p><br>
<input type="button" value="Fill" onclick="fill(H iddenInput1)"
runat="server">
<br>
<br>
<input type="text" id="HiddenInput 1" runat="server">
This will be the hidden labe...it just shows that the session var was
retrieved </p>
</form>
</body>
</html>
Dec 5 '05 #1
1 1459
<%@ Page language="c#" debug="true" ContentType="te xt/html"
ResponseEncodin g="iso-8859-1" %>
<script runat="server">
void Page_Load()
{
if(Page.IsPostB ack)
{

}
else
{
//get name from TextBox
string myVar =name.Value;

//add name to session
Session.Add("se ssionVar1", myVar);

//store session var in a hidden input so it can be retrieved from
//VBScript
string retrievedSessio nVar=(string) Session["sessionVar 1"];

//show that var was retrieved successfully
HiddenInput1.Va lue = retrievedSessio nVar;
}
}
</script>

<script language="vbscr ipt">

private sub fill()
dim Name
Name = document.all.Hi ddenInput1.valu e
retrieve(Name)
end sub

private sub retrieve(Name)
document.all.na me2.value=Name
end sub

</script>
<html>
<head>
<title>Test</title>

</head>
<body>
<form>
<p>
<input type="text" ID="name" Value="Frank" runat="server">
simply stores and shows the session var value </p>
<p><br>
<input type="text" ID="name2" name="name2">
This is the box that should display the session var via the vbscript
</p>
<p><br>
<input type="button" value="Fill" onclick="fill() "
runat="server">
<br>
<br>
<input type="text" id="HiddenInput 1" runat="server">
This will be the hidden labe...it just shows that the session var was
retrieved </p>
</form>
</body>
</html>

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Frank" wrote:
Can I do this?

I add a session var in C# and ultimatly want to pass it into a vbscript
client side activeX control. This is what I have so far but get " Object
Required:'name2 ' " error.

Can anyone suggest a btter way of passing a session var into a vbscript
function?

<%@ Page language="c#" debug="true" ContentType="te xt/html"
ResponseEncodin g="iso-8859-1" %>
<script runat="server">
void Page_Load()
{
if(Page.IsPostB ack)
{

}
else
{
//get name from TextBox
string myVar =name.Value;

//add name to session
Session.Add("se ssionVar1", myVar);

//store session var in a hidden input so it can be retrieved from
VBScript
string retrievedSessio nVar=(string) Session["sessionVar 1"];

//show that var was retrieved successfully
HiddenInput1.Va lue = retrievedSessio nVar;
}
}
</script>

<script language="vbscr ipt">

private sub fill(HiddenInpu t1)
dim Name
Name = HiddenInput1.va lue
retrieve(Name)
end sub

private sub retrieve(Name)
name2.value=Nam e
end sub

</script>
<html>
<head>
<title>Test</title>

</head>
<body>
<form>
<p>
<input type="text" ID="name" Value="Frank" runat="server">
simply stores and shows the session var value </p>
<p><br>
<input type="text" ID="name2" name="name2">
This is the box that should display the session var via the vbscript
</p>
<p><br>
<input type="button" value="Fill" onclick="fill(H iddenInput1)"
runat="server">
<br>
<br>
<input type="text" id="HiddenInput 1" runat="server">
This will be the hidden labe...it just shows that the session var was
retrieved </p>
</form>
</body>
</html>

Dec 5 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2155
by: Paul fpvt2 | last post by:
One of our client is using IIS 6 on Windows 2003 server. ASP pages on their website can not pass the session variable from page to page. For example, TestFrom.asp sets session variable session("IM_Rights") to 4, and TestTo.asp retrieves it. But, in TestTo.asp session("IM_Rights") is "" instead of 4. In IIS, for the site's property, checkbox “Enable Session State” is checked and Session Timeout = 20.
0
1093
by: farooq | last post by:
Hi guys, I’m facing some problem can u solve it. Problem is: I’m giving user Id and password in (Login_sess.asp) and submit it to page (sess_test.asp). I am setting session variable (session(“Sin”)=”Yes”) just before redirecting to the same page, but in first time I do not received the value of session variable when I redirect it, when I execute this process second time or redirect it only with the page name...
1
1895
by: farooqazeem | last post by:
Hi guys, I’m facing some problem can u solve it. Problem is: I’m giving user Id and password in (Login_sess.asp) and submit it to page (sess_test.asp). I am setting session variable (session(“Sin”)=”Yes”) just before redirecting to the same page, but in first time I do not received the value of session variable when I redirect it, when I execute this process second time or redirect it only with the page name...
9
3706
by: Colin Graham | last post by:
hi folks, just wonder if this is possible or is there a better way of doing this. i need to store values in cookies between two forms. the details are added in a popup when this is closed the main form stores these values in hidden fields. at this point xml is built up and submitted to a biztalk server. if there is an error the page is refreshed and the initial values i added via the popup are lost. my idea was to store these as...
5
2749
by: Kathy Burke | last post by:
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
2
2847
by: Frank | last post by:
Can I do this? I add a session var in C# and ultimatly want to pass it into a vbscript client side activeX control. This is what I have so far but get " Object Required:'name2' " error. Can anyone suggest a btter way of passing a session var into a vbscript function? <%@ Page language="c#" debug="true" ContentType="text/html"
0
2470
by: TRB_NV | last post by:
I'd been using an Access database based shopping cart, but wanted to change it so that it would use session variables. I have a form that's submitted to a page called addtocart.asp that contains the following information: intProdID -- ProductID strProdName -- Product Name intQuant -- Quantity intProdPrice -- Price productType -- Type of product (ie. Wine, Cheese, etc...)
2
2077
by: Athenian | last post by:
Hi guys. Currently I need a javascript (client side) or vbscript(server side) code to check automatically for session expiration and force the redirection to a message page or the log-in page. All web site is built around asp pages. Thank you very much for your help
11
3714
by: Jerry | last post by:
I'm using this code: Dim strName For Each strName in Session.Contents Response.Write strName & " - " & Session.Contents(strName) & "<BR>" Next If I only do a response.write strName, it shows all the session names but when I include the session.contents it gives me the following error:
3
8455
by: sjsean | last post by:
All thanks in advance for reading my post. I am new to using js and more accustomed to vbscript. I had written code which created a shopping cart into an array using vbscript and then transferred the information into a session variable. However what I didn't know was that deleting/manipulating information in an array using vbscript was not that easy. In doing some reading and research it seemed that js was more flexible in this...
0
8259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8696
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7188
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6119
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.