Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Imports

Reply
Thread Tools

Imports

 
 
=?Utf-8?B?anNhbGU=?=
Guest
Posts: n/a
 
      12-20-2004
If I put
imports xxx.ModuleName
at the top of my asp.net page vb code, does this create an instance of the
imported module that is unique to the page or does it just allow shared
access to the module's functions?
cheers,
jsale
 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      12-20-2004
Imports is just a notation that instructs the compiler to look into a
particular namespace when a name is found that doesn't seem to belong to the
"current" namespace.
It doesn't do "things" like creating an instance of a module.

It looks like what you are looking is that a module is actually a class with
shared members (my personal preference would be to use this instead, you
loose just the ability to call its members wihtout appending the class name
before)...

--

"jsale" <> a écrit dans le message de
news:5CD0FADF-90FD-430B-A719-...
> If I put
> imports xxx.ModuleName
> at the top of my asp.net page vb code, does this create an instance of the
> imported module that is unique to the page or does it just allow shared
> access to the module's functions?
> cheers,
> jsale



 
Reply With Quote
 
 
 
 
=?Utf-8?B?anNhbGU=?=
Guest
Posts: n/a
 
      12-20-2004
if i made the module into a class and instanced it on each page that uses the
functions, would i be right in saying that there is no real way data could be
'leaked' between users?
you may remember me from some session questions last week - i'm still having
problems with the information appearing on different users' screens and my
main thought is that using the modules, they;re not instanced at any point,
therefore if more than one user is using them at once, there could be leakage
and errors. maybe...
cheers for the information patrice

"Patrice" wrote:

> Imports is just a notation that instructs the compiler to look into a
> particular namespace when a name is found that doesn't seem to belong to the
> "current" namespace.
> It doesn't do "things" like creating an instance of a module.
>
> It looks like what you are looking is that a module is actually a class with
> shared members (my personal preference would be to use this instead, you
> loose just the ability to call its members wihtout appending the class name
> before)...
>
> --
>
> "jsale" <> a écrit dans le message de
> news:5CD0FADF-90FD-430B-A719-...
> > If I put
> > imports xxx.ModuleName
> > at the top of my asp.net page vb code, does this create an instance of the
> > imported module that is unique to the page or does it just allow shared
> > access to the module's functions?
> > cheers,
> > jsale

>
>
>

 
Reply With Quote
 
Shiva
Guest
Posts: n/a
 
      12-20-2004
Imports doesn't instantiate any modules/types. Its just for type name
resolution only. It has effect only in the included page.

"jsale" <> wrote in message
news:5CD0FADF-90FD-430B-A719-...
If I put
imports xxx.ModuleName
at the top of my asp.net page vb code, does this create an instance of the
imported module that is unique to the page or does it just allow shared
access to the module's functions?
cheers,
jsale


 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      12-20-2004
Actually the problme is that shared members (either as members of a class or
implicitely in a module are "shared" by the whole application and an ASP.NET
site is a single application.
As a result, users are sharing the same variables.

You shouldn't use modules or a class with shared members. use a class and
instantie this class for each user so that they have each their own copy...

Patrice

--

"jsale" <> a écrit dans le message de
news08396FD-7F51-45E6-84F9-...
> if i made the module into a class and instanced it on each page that uses

the
> functions, would i be right in saying that there is no real way data could

be
> 'leaked' between users?
> you may remember me from some session questions last week - i'm still

having
> problems with the information appearing on different users' screens and my
> main thought is that using the modules, they;re not instanced at any

point,
> therefore if more than one user is using them at once, there could be

leakage
> and errors. maybe...
> cheers for the information patrice
>
> "Patrice" wrote:
>
> > Imports is just a notation that instructs the compiler to look into a
> > particular namespace when a name is found that doesn't seem to belong to

the
> > "current" namespace.
> > It doesn't do "things" like creating an instance of a module.
> >
> > It looks like what you are looking is that a module is actually a class

with
> > shared members (my personal preference would be to use this instead, you
> > loose just the ability to call its members wihtout appending the class

name
> > before)...
> >
> > --
> >
> > "jsale" <> a écrit dans le message de
> > news:5CD0FADF-90FD-430B-A719-...
> > > If I put
> > > imports xxx.ModuleName
> > > at the top of my asp.net page vb code, does this create an instance of

the
> > > imported module that is unique to the page or does it just allow

shared
> > > access to the module's functions?
> > > cheers,
> > > jsale

> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic imports + relative imports in Python 3 zildjohn01 Python 0 02-22-2011 05:24 PM
Imports System.Data or Imports System.Data.SqlClient? Albert ASP .Net 4 07-10-2008 09:00 AM
Re: Imports Jim Heavey ASP .Net 1 10-17-2003 06:00 PM
REFERENCE VS IMPORTS Bite My Bubbles ASP .Net 0 08-25-2003 09:00 PM
Imports 'System.DirectoryServices' cannot be found. Edward ASP .Net 1 07-08-2003 12:45 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57