473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Procedures don't have access to public Variables in ASP

Hi.

I have the following which I use either on my server using cscript (.vbs
file) or identical code in my ASP pages. The problem is when running in ASP
I recieve the following error:
Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'iMsg'
/scripts/processdata.asp, line 257

The error is raised when my DeallocateResouces procedure attempts to
deallocate resources for objects (set iMsg = Nothing). However, when I run
my .vbs file which is on the server using wscript or cscript all is fine.
Just like in VB. The only difference is the QuitOnError() procedure. In
the ASP file I use scripting to popup alert to user. However in .vbs file
on server I write events to app log.

Why don't my procedures have access to the variables in asp, but do in
standard vbs files? How do I fix? As you know, by default procedures are
public. Thank you in advance

<<<<<Code of .asp file used on web and also in .vbs file on server>>>>
..
..
..
call SendEmail
call DeallocateResources

sub SendEmail
' on error resume next
dim iMsg, iConf, Flds

const cdoSendUsingPort = 2

set iMsg = CreateObject("CDO.Message")
call QuitOnError
set iConf = CreateObject("CDO.Configuration")
call QuitOnError
set Flds = iConf.Fields
call QuitOnError
..
..
..
end sub

sub DeallocateResources()
' on error resume next

set iMsg = Nothing
set iConf = Nothing
set Flds = Nothing
end sub

sub QuitOnError()
' on error resume next

if err.number <> 0 then
%>
<script language="vbscript">
alert("Your message could not be sent at this time. Please click the
Back button and try again.")
</script>
<%
call DeallocateResources
Response.Clear
Response.End
end if
end sub


Sep 17 '05 #1
2 1622
Bobby Howell wrote on 17 sep 2005 in
microsoft.public.inetserver.asp.general:
Why don't my procedures have access to the variables in asp, but do in
standard vbs files? How do I fix? As you know, by default procedures
are public. Thank you in advance


ASP has a seperate user, having not much security-clearance.

It is a good thing ASP-scriptcodes cannot reach the internals of your
server.

Use a session [or application] variable for in-ASP cross-page variable.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Sep 17 '05 #2
Bobby Howell wrote:
Hi.

I have the following which I use either on my server using cscript
(.vbs file) or identical code in my ASP pages. The problem is when
running in ASP I recieve the following error:
Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'iMsg'
/scripts/processdata.asp, line 257

The error is raised when my DeallocateResouces procedure attempts to
deallocate resources for objects (set iMsg = Nothing). However,
when I run my .vbs file which is on the server using wscript or
cscript all is fine. Just like in VB. The only difference is the
QuitOnError() procedure. In the ASP file I use scripting to popup
alert to user. However in .vbs file on server I write events to app
log.
Why don't my procedures have access to the variables in asp, but do in
standard vbs files? How do I fix? As you know, by default
procedures are public. Thank you in advance

<<<<<Code of .asp file used on web and also in .vbs file on server>>>>
.
.
.
call SendEmail
call DeallocateResources

sub SendEmail
' on error resume next
dim iMsg, iConf, Flds
Since these are declared inside the sub, they are NOT pupblic variables.
They need to be declared outside the sub in order to be public ...
--

Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Sep 17 '05 #3

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

Similar topics

1
by: zlatko | last post by:
I use a stored procedure that is calling several other stored procedure which update or append values in several tables. All of them are stored procedures with input parameters by which they filter...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
5
by: Tim Marshall | last post by:
I was following the thread "Re: Access Treeview - Is it Safe Yet?" with interest and on reading the post describing Lauren Quantrell's SmartTree, I've run into something I don't understand: Stored...
2
by: Quinnie | last post by:
Hi, I have a homework assignment that I'm so confused and really need help with. Here's the description, any help would be appreciated. Thanks! Assume we have a statically-scoped language...
3
by: R Millman | last post by:
under ASP.NET, single stepping in debug mode appears not to stop within event procedures. i.e. 1) Create web page with submit button and event procedure for the click event in the code behind...
15
by: Iced Crow | last post by:
In C# I know that you can use delegates to assing multiple addresses of sub and functions to a delegate and have it fire multiple procedures... How do I do this in VB? I only know of assigning...
8
by: gemel | last post by:
I have been reading sime material in .NET that throws some doubt on my understanding of shared procedures. With regard to object programming I assumed that variables declared within a class were...
5
by: patrick.cc.choi | last post by:
Hi all, In Oracle stored procedures, you can declare sub-procedures to help modularize your code... i.e. CREATE OR REPLACE PROCEDURE myProcedure is PROCEDURE b (field1 INTEGER, field2...
18
by: Andrew Wan | last post by:
I have been developing web applications with ASP & Javascript for a long time. I have been using Visual Studio 2003.NET. While VS2003 is okay for intellisense of ASP & Javascript, it's still not...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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 project—planning, coding, testing,...

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.