Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editing ASP variables in VB script

Status
Not open for further replies.

YvonneTsang

Programmer
Sep 28, 2001
37
CA
Is there a way to edit ASP variables in VB script? I know you can read the values of teh ASP variables with <%=variable%> but is there a way to set ASP variables?
 
Hi

You assign values to variables like so:

<%
variablename = &quot;text content&quot;
othervar = 3 'if you want to assign a number
%>

Bye.
 
maybe I didn't word my question well. I have a value stored in a VB script variable and I want to store that value in an ASP variable. How do I go about and do this
 
Hi,

There is no such thing as an ASP variable because ASP is not a language, it's a technology. You write ASP using a language like jscript, vbscript, perl... So the variables in an ASP page are vbscript variables if the language you're using is vbscript.

Maybe if you describe in more details what you're trying to do, I could be of more help.

Bye.
 
is there a way to set the values of the ASP session values to the values of my VB script values from my VBscript. Or any variables that I declared in my ASP section with values in a section of VB script.
 
Hi,

This is how to set a session variable:

<%
varName = &quot;John Doe&quot;
session(&quot;name_of_variable&quot;) = varName
%>

Bye.
 
Dear Terry,

I think the question you are asking is about how you share variables between client-sided VBScript and the VBScript ran server-side inside ASP pages. The honest answer is that you can't. The ASP page runs on the server, creates a web-page, and then ceases. The results (the web-page) are then passed back to the client (your browser) and any client-sided scripts (JavaScript, VBScript) are then run. They do not have access to anything that happened when the ASP page was being run, though. Only the resulting HTML (and no variables or suchlike from the ASP page) is passed back to the browser as this is all the browser understands and expects.

However, this is not to say that what you want to do is impossible. If you can give a description of why you want to do it, perhaps someone here has a solution.

Regards,
Simon
 
What Simon states above is theoretically(sp?) completely true. However there are workarounds. Basically it involves re-submitting your page with a variable value passed in the URL using the GET method, or in a hidden field using the POST method. Thats a broad outline of how it can be done. If you need more specific help, do as Simon suggested and let us know what you want to acheive.

G -GTM Solutions, Home of USITE-
-=
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top