473,287 Members | 1,663 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,287 software developers and data experts.

Still not clear about global functions

Hello,

I have spent ages trawling through Google, looking for information about
global functions in ASP.NET and I'm still not clear about the best way
to go about this (or not).

I am writing a site that will be for members only. They will have to log
in to gain access to any of the pages. I am holding the user information
in an XML file (there will probably never be a large number of user, so
this is efficient enough).

What I would like to do is have a global function that I can use to get
user settings out of the XML file. For example, if I called ...

UserSettings("accessLevel")

then I would get the access level setting for the currently logged in
user (where "accessLevel" is something I put in the XML file).

After researching this, two main points seem to come up over and over
again...

1) To use global functions, create a class and add the functions in
there. If they are static, then you don't need to instantiate the class,
you just call MyStuff.UserSettings("accessLevel").

2) Don't have global functions, it's not the OOP way.

The problems I have are (in relation to these two points)...

1) OK, so I can create a file called MyStuff.cs, which contains a class
and the static members. What do I do with it then? I guess if you are
using VS, then that's all you need to do, but I'm using a text editor.
What do I do with the .cs file when I've created it? No-one seems to
mention that point.

2) What's a better (ie more OOP) way to do this? I'm very keen to learn
the right way to do things, but I can't see one here.

Any advice appreciated.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #1
14 1629
1) OK, so I can create a file called MyStuff.cs, which contains a class
and the static members. What do I do with it then? I guess if you are
using VS, then that's all you need to do, but I'm using a text editor.
What do I do with the .cs file when I've created it? No-one seems to
mention that point.

2) What's a better (ie more OOP) way to do this? I'm very keen to learn
the right way to do things, but I can't see one here.

Any advice appreciated.

--
Alan Silver
(anything added below this line is nothing to do with me)


How do you currently compile more than 1 class file into a single assembly?
If you don't, and you would prefer to use a single file, you can move the
class definition to the single file you use. 1 file can contain more than 1
class definition :)

Other than that, I do not know how to compile from the command line without
researching it. This is because, I don't do it and never needed to.

HTH,

Mythran

Nov 19 '05 #2
re:
1) OK, so I can create a file called MyStuff.cs, which contains a class and the static
members. What do I do with it then?
Just open a command window ( cmd.exe );
make sure that the .Net Framework directory is in your path
( the .Net dir is where the compilers are located (vbc.exe, csc.exe));
navigate to the directory where you have your .vb files,
and run the compile command :

csc /t:library /out:MyStuff.dll MyStuff.cs

If you need to import .Net classes, include them in your command line:
csc /t:library /r:system.dll /r:system.web.dll /out:MyStuff.dll MyStuff.cs

MyStuff.dll will be created/compiled in the current directory.

Move it to the /bin directory of your application and fire away.
If you want to have VS.NET use it, reference it in your project.

You can now call the classes in MyStuff.dll using
YourClassName.yourmethod, as long as you import
the assembly into your aspx file :

<%@ Import Namespace="YourClassname" %>

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Alan Silver" <al*********@nospam.thanx> wrote in message
news:C6**************@nospamthankyou.spam... Hello,

I have spent ages trawling through Google, looking for information about global
functions in ASP.NET and I'm still not clear about the best way to go about this (or
not).

I am writing a site that will be for members only. They will have to log in to gain
access to any of the pages. I am holding the user information in an XML file (there will
probably never be a large number of user, so this is efficient enough).

What I would like to do is have a global function that I can use to get user settings
out of the XML file. For example, if I called ...

UserSettings("accessLevel")

then I would get the access level setting for the currently logged in user (where
"accessLevel" is something I put in the XML file).

After researching this, two main points seem to come up over and over again...

1) To use global functions, create a class and add the functions in there. If they are
static, then you don't need to instantiate the class, you just call
MyStuff.UserSettings("accessLevel").

2) Don't have global functions, it's not the OOP way.

The problems I have are (in relation to these two points)...

1) OK, so I can create a file called MyStuff.cs, which contains a class and the static
members. What do I do with it then? I guess if you are using VS, then that's all you
need to do, but I'm using a text editor. What do I do with the .cs file when I've
created it? No-one seems to mention that point.

2) What's a better (ie more OOP) way to do this? I'm very keen to learn the right way to
do things, but I can't see one here.

Any advice appreciated.

--
Alan Silver
(anything added below this line is nothing to do with me)

Nov 19 '05 #3
errata :
navigate to the directory where you have your .vb files,
should be : navigate to the directory where you have your .cs files,

and
<%@ Import Namespace="YourClassname" %>
Should be :
<%@ Import Namespace="YourNameSpace" %>
Sorry...


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... re:
1) OK, so I can create a file called MyStuff.cs, which contains a class and the static
members. What do I do with it then?


Just open a command window ( cmd.exe );
make sure that the .Net Framework directory is in your path
( the .Net dir is where the compilers are located (vbc.exe, csc.exe));
navigate to the directory where you have your .vb files,
and run the compile command :

csc /t:library /out:MyStuff.dll MyStuff.cs

If you need to import .Net classes, include them in your command line:
csc /t:library /r:system.dll /r:system.web.dll /out:MyStuff.dll MyStuff.cs

MyStuff.dll will be created/compiled in the current directory.

Move it to the /bin directory of your application and fire away.
If you want to have VS.NET use it, reference it in your project.

You can now call the classes in MyStuff.dll using
YourClassName.yourmethod, as long as you import
the assembly into your aspx file :

<%@ Import Namespace="YourClassname" %>

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Alan Silver" <al*********@nospam.thanx> wrote in message
news:C6**************@nospamthankyou.spam...
Hello,

I have spent ages trawling through Google, looking for information about global
functions in ASP.NET and I'm still not clear about the best way to go about this (or
not).

I am writing a site that will be for members only. They will have to log in to gain
access to any of the pages. I am holding the user information in an XML file (there
will probably never be a large number of user, so this is efficient enough).

What I would like to do is have a global function that I can use to get user settings
out of the XML file. For example, if I called ...

UserSettings("accessLevel")

then I would get the access level setting for the currently logged in user (where
"accessLevel" is something I put in the XML file).

After researching this, two main points seem to come up over and over again...

1) To use global functions, create a class and add the functions in there. If they are
static, then you don't need to instantiate the class, you just call
MyStuff.UserSettings("accessLevel").

2) Don't have global functions, it's not the OOP way.

The problems I have are (in relation to these two points)...

1) OK, so I can create a file called MyStuff.cs, which contains a class and the static
members. What do I do with it then? I guess if you are using VS, then that's all you
need to do, but I'm using a text editor. What do I do with the .cs file when I've
created it? No-one seems to mention that point.

2) What's a better (ie more OOP) way to do this? I'm very keen to learn the right way
to do things, but I can't see one here.

Any advice appreciated.

--
Alan Silver
(anything added below this line is nothing to do with me)


Nov 19 '05 #4
Juan,

Thanks for your answer. I suppose it's kinda obvious that they should be
compiled into DLLs, but I wasn't sure and no-one seemed to specify.

I suppose they can't be done from source files? DLLs aren't a huge
problem (not like COM DLLs in Classic ASP), but one huge advantage of
source files (like .aspx files) is that you can do quick changes on the
fly.

As to the other question, is this a sensible approach altogether? I
can't see how you can get around having a global function here, but
everyone seems to say that they are really against the idea of OOP.

Thanks for the reply.
a
re:
1) OK, so I can create a file called MyStuff.cs, which contains a
class and the static
members. What do I do with it then?


Just open a command window ( cmd.exe );
make sure that the .Net Framework directory is in your path
( the .Net dir is where the compilers are located (vbc.exe, csc.exe));
navigate to the directory where you have your .vb files,
and run the compile command :

csc /t:library /out:MyStuff.dll MyStuff.cs

If you need to import .Net classes, include them in your command line:
csc /t:library /r:system.dll /r:system.web.dll /out:MyStuff.dll MyStuff.cs

MyStuff.dll will be created/compiled in the current directory.

Move it to the /bin directory of your application and fire away.
If you want to have VS.NET use it, reference it in your project.

You can now call the classes in MyStuff.dll using
YourClassName.yourmethod, as long as you import
the assembly into your aspx file :

<%@ Import Namespace="YourClassname" %>

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Alan Silver" <al*********@nospam.thanx> wrote in message
news:C6**************@nospamthankyou.spam...
Hello,

I have spent ages trawling through Google, looking for information
about global
functions in ASP.NET and I'm still not clear about the best way to go
about this (or
not).

I am writing a site that will be for members only. They will have to
log in to gain
access to any of the pages. I am holding the user information in an
XML file (there will
probably never be a large number of user, so this is efficient enough).

What I would like to do is have a global function that I can use to
get user settings
out of the XML file. For example, if I called ...

UserSettings("accessLevel")

then I would get the access level setting for the currently logged in
user (where
"accessLevel" is something I put in the XML file).

After researching this, two main points seem to come up over and over
again...

1) To use global functions, create a class and add the functions in
there. If they are
static, then you don't need to instantiate the class, you just call
MyStuff.UserSettings("accessLevel").

2) Don't have global functions, it's not the OOP way.

The problems I have are (in relation to these two points)...

1) OK, so I can create a file called MyStuff.cs, which contains a
class and the static
members. What do I do with it then? I guess if you are using VS, then
that's all you
need to do, but I'm using a text editor. What do I do with the .cs
file when I've
created it? No-one seems to mention that point.

2) What's a better (ie more OOP) way to do this? I'm very keen to
learn the right way to
do things, but I can't see one here.

Any advice appreciated.

--
Alan Silver
(anything added below this line is nothing to do with me)



--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #5
>> 1) OK, so I can create a file called MyStuff.cs, which contains a class
and the static members. What do I do with it then? I guess if you are
using VS, then that's all you need to do, but I'm using a text editor.
What do I do with the .cs file when I've created it? No-one seems to
mention that point.

2) What's a better (ie more OOP) way to do this? I'm very keen to
learn the right way to do things, but I can't see one here.

Any advice appreciated.

-- Alan Silver
(anything added below this line is nothing to do with me)
How do you currently compile more than 1 class file into a single
assembly? If you don't, and you would prefer to use a single file, you
can move the class definition to the single file you use. 1 file can
contain more than 1 class definition :)


OK, you're ahead of me already!! I should have said that I'm relatively
new at this and am learning as I go along. I have got as far as creating
..aspx and .ascx files, but haven't yet ventured into DLLs. I didn't
realise that class files had to be compiled into DLLs.
Other than that, I do not know how to compile from the command line
without researching it. This is because, I don't do it and never
needed to.


I knew how to compile a DLL from the command line (read about it in a
book), but I didn't realise that was what as needed here.

Thanks for the reply.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #6
Hi, Alan.

re:
I suppose they can't be done from source files?
You could, but it's not good to publish source code.

One of the great advantages of assemblies ( DLLs ) is that they
give you a measure of protection against those who would simply
copy your source code.

re: As to the other question, is this a sensible approach altogether?
Sure it is...

Using classes is more efficient and helps you organize your code functions.

re: I can't see how you can get around having a global function here, but everyone seems to
say that they are really against the idea of OOP.
Tell "everyone" that OOP *is* the standard,
and the most efficient, way to manage functionality.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Alan Silver" <al*********@nospam.thanx> wrote in message
news:VH**************@nospamthankyou.spam... Juan,

Thanks for your answer. I suppose it's kinda obvious that they should be compiled into
DLLs, but I wasn't sure and no-one seemed to specify.

I suppose they can't be done from source files? DLLs aren't a huge problem (not like COM
DLLs in Classic ASP), but one huge advantage of source files (like .aspx files) is that
you can do quick changes on the fly.

As to the other question, is this a sensible approach altogether? I can't see how you
can get around having a global function here, but everyone seems to say that they are
really against the idea of OOP.

Thanks for the reply.
a
re:
1) OK, so I can create a file called MyStuff.cs, which contains a class and the static
members. What do I do with it then?


Just open a command window ( cmd.exe );
make sure that the .Net Framework directory is in your path
( the .Net dir is where the compilers are located (vbc.exe, csc.exe));
navigate to the directory where you have your .vb files,
and run the compile command :

csc /t:library /out:MyStuff.dll MyStuff.cs

If you need to import .Net classes, include them in your command line:
csc /t:library /r:system.dll /r:system.web.dll /out:MyStuff.dll MyStuff.cs

MyStuff.dll will be created/compiled in the current directory.

Move it to the /bin directory of your application and fire away.
If you want to have VS.NET use it, reference it in your project.

You can now call the classes in MyStuff.dll using
YourClassName.yourmethod, as long as you import
the assembly into your aspx file :

<%@ Import Namespace="YourClassname" %>

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Alan Silver" <al*********@nospam.thanx> wrote in message
news:C6**************@nospamthankyou.spam...
Hello,

I have spent ages trawling through Google, looking for information about global
functions in ASP.NET and I'm still not clear about the best way to go about this (or
not).

I am writing a site that will be for members only. They will have to log in to gain
access to any of the pages. I am holding the user information in an XML file (there
will
probably never be a large number of user, so this is efficient enough).

What I would like to do is have a global function that I can use to get user settings
out of the XML file. For example, if I called ...

UserSettings("accessLevel")

then I would get the access level setting for the currently logged in user (where
"accessLevel" is something I put in the XML file).

After researching this, two main points seem to come up over and over again...

1) To use global functions, create a class and add the functions in there. If they are
static, then you don't need to instantiate the class, you just call
MyStuff.UserSettings("accessLevel").

2) Don't have global functions, it's not the OOP way.

The problems I have are (in relation to these two points)...

1) OK, so I can create a file called MyStuff.cs, which contains a class and the static
members. What do I do with it then? I guess if you are using VS, then that's all you
need to do, but I'm using a text editor. What do I do with the .cs file when I've
created it? No-one seems to mention that point.

2) What's a better (ie more OOP) way to do this? I'm very keen to learn the right way
to
do things, but I can't see one here.

Any advice appreciated.

--
Alan Silver
(anything added below this line is nothing to do with me)



--
Alan Silver
(anything added below this line is nothing to do with me)

Nov 19 '05 #7
>> I suppose they can't be done from source files?

You could, but it's not good to publish source code.

One of the great advantages of assemblies ( DLLs ) is that they
give you a measure of protection against those who would simply
copy your source code.
Hmm, aren't .aspx files source files? I mean code-beside. I know, you'll
tell me that this is a good argument against code-beside!!

Anyway, given the simplicity of replacing a DLL in ASP.NET (unlike COM
DLLs in Classic ASP), it's not really a problem, I just wanted to make
sure I understood the full picture.
re:
As to the other question, is this a sensible approach altogether?
Sure it is...

Using classes is more efficient and helps you organize your code functions.


Even when the class is artificial? In the example I have, the fact of
having a class is really immaterial. I could just as easily have a
global function without a class, if there were a simple way to do this.

Creating classes merely to organise functions is a bit like putting
functions in organised standard modules in VB6. There's nothing
inherently OOP about it, it's just a way to put each on with others of
its kind.
re:
I can't see how you can get around having a global function here, but
everyone seems to
say that they are really against the idea of OOP.


Tell "everyone" that OOP *is* the standard,
and the most efficient, way to manage functionality.


I guess the same comments apply here. It isn't *really* OOP, it's using
classes as a method of organising.

As usual, your comments are greatly appreciated.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #8
re:
you'll tell me that this is a good argument against code-beside!!
You got it!

:-)

re: Creating classes merely to organise functions is a bit like putting functions in
organised standard modules in VB6.
Of course, function organization is not the only benefit received from OOP.

re: There's nothing inherently OOP about it, it's just a way to put each on with others of
its kind.
True, but there's absolutely no way to work with OOP
except by using classes, AFAIK. Can you think of one ?

re: I guess the same comments apply here. It isn't *really* OOP, it's using classes as a
method of organising.
See above.

re: As usual, your comments are greatly appreciated.


Thanks. I try to do my best.

Sometimes I hit the nail on the head.
Other times I find I really need to take a break!

;-)

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Alan Silver" <al*********@nospam.thanx> wrote in message
news:Sa**************@nospamthankyou.spam...
I suppose they can't be done from source files?


You could, but it's not good to publish source code.

One of the great advantages of assemblies ( DLLs ) is that they
give you a measure of protection against those who would simply
copy your source code.


Hmm, aren't .aspx files source files? I mean code-beside. I know, you'll tell me that
this is a good argument against code-beside!!

Anyway, given the simplicity of replacing a DLL in ASP.NET (unlike COM DLLs in Classic
ASP), it's not really a problem, I just wanted to make sure I understood the full
picture.
re:
As to the other question, is this a sensible approach altogether?


Sure it is...

Using classes is more efficient and helps you organize your code functions.


Even when the class is artificial? In the example I have, the fact of having a class is
really immaterial. I could just as easily have a global function without a class, if
there were a simple way to do this.

Creating classes merely to organise functions is a bit like putting functions in
organised standard modules in VB6. There's nothing inherently OOP about it, it's just a
way to put each on with others of its kind.
re:
I can't see how you can get around having a global function here, but everyone seems
to
say that they are really against the idea of OOP.


Tell "everyone" that OOP *is* the standard,
and the most efficient, way to manage functionality.


I guess the same comments apply here. It isn't *really* OOP, it's using classes as a
method of organising.

As usual, your comments are greatly appreciated.

--
Alan Silver
(anything added below this line is nothing to do with me)

Nov 19 '05 #9
>> Creating classes merely to organise functions is a bit like putting
functions in
organised standard modules in VB6.
Of course, function organization is not the only benefit received from OOP.


No, but in this case, it seems to be the only benefit.
re:
There's nothing inherently OOP about it, it's just a way to put each
on with others of
its kind.


True, but there's absolutely no way to work with OOP
except by using classes, AFAIK. Can you think of one ?


No, but that wasn't what I meant. I meant that this way doesn't seem to
have any advantages over using a common include file. Therefore, this
isn't really an OOP issue.

I have no problem with putting such functions into a class, I was just
checking if I was missing something important when I couldn't see any
benefit from the class as opposed to the include file. It sounds like
you're saying that in this case, there isn't any specific benefit to a
class, it's just a convenient way of doing it.

After posting, I realised that I have one more problem here. Now that
the function has been moved into a class, how does it get access to
things like the Server object? When the function was in the .aspx, this
was readily available. Now it's in a class, I guess I need some way of
telling the class that it's going to be in an ASP.NET page. How do I do
that? Does the class need to inherit from something? If so, what?

Thanks again.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #10
>After posting, I realised that I have one more problem here. Now that
the function has been moved into a class, how does it get access to
things like the Server object? When the function was in the .aspx, this
was readily available. Now it's in a class, I guess I need some way of
telling the class that it's going to be in an ASP.NET page. How do I do
that? Does the class need to inherit from something? If so, what?


OK, it looks as if I need to inherit from the Page object. I tried this,
but ran into problems when trying to use MapPath. The code is shown
below...

using System.Web.UI;

namespace PixataUtils {
public class Util : Page {
public static string UserVars(string varName) {
return Server.MapPath("/");
}
}
}

When I try to compile this, I get the following error...

Util.cs(6,14): error CS0118: 'System.Web.UI.Page.Server' denotes a
'property' where a 'class' was expected

Any idea what this means? As far as I can see from the SDK, Server *is*
a class, it's a member of the Page object.

Any advice welcome!! Thanks.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #11
For the Server object you can use System.Web.HttpServerUtility.

http://www.csharpfriends.com/quickst...pServerUtility

For other objects, use System.Web.HttpApplication
See its list of properties for ASP.NET objects at :

http://www.csharpfriends.com/quickst...ttpApplication

You should also look at System.Web.HttpContext :
http://www.csharpfriends.com/quickst...ss=HttpContext


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Alan Silver" <al*********@nospam.thanx> wrote in message
news:yW**************@nospamthankyou.spam...
Creating classes merely to organise functions is a bit like putting functions in
organised standard modules in VB6.


Of course, function organization is not the only benefit received from OOP.


No, but in this case, it seems to be the only benefit.
re:
There's nothing inherently OOP about it, it's just a way to put each on with others of
its kind.


True, but there's absolutely no way to work with OOP
except by using classes, AFAIK. Can you think of one ?


No, but that wasn't what I meant. I meant that this way doesn't seem to have any
advantages over using a common include file. Therefore, this isn't really an OOP issue.

I have no problem with putting such functions into a class, I was just checking if I was
missing something important when I couldn't see any benefit from the class as opposed to
the include file. It sounds like you're saying that in this case, there isn't any
specific benefit to a class, it's just a convenient way of doing it.

After posting, I realised that I have one more problem here. Now that the function has
been moved into a class, how does it get access to things like the Server object? When
the function was in the .aspx, this was readily available. Now it's in a class, I guess
I need some way of telling the class that it's going to be in an ASP.NET page. How do I
do that? Does the class need to inherit from something? If so, what?

Thanks again.

--
Alan Silver
(anything added below this line is nothing to do with me)


Nov 19 '05 #12
Thanks for those links.

I actually discovered (shortly after posting - as usual) an old post
that discussed this exact subject. It pointed out that static methods
are assumed to be called without the object being created. At the point
the static member is in existence, the Page object hasn't been created,
so the reference to Server doesn't point to an object.

I don't think I explained that very well, but basically what I did was
change the method to be non-static, and it compiled fine. In the calling
page, I just created an instance of the class first. Then the code
worked fine.

Thanks again
For the Server object you can use System.Web.HttpServerUtility.

http://www.csharpfriends.com/quickst...assbrowser/vb/
classbrowser.aspx?assembly=System.Web,%20Version= 1.0.5000.0,%20Culture=n
eutral,%20PublicKeyToken=b03f5f7f11d50a3a&namespa ce=System.Web&class=Htt
pServerUtility

For other objects, use System.Web.HttpApplication
See its list of properties for ASP.NET objects at :

http://www.csharpfriends.com/quickst...assbrowser/vb/
classbrowser.aspx?assembly=System.Web,%20Version= 1.0.5000.0,%20Culture=n
eutral,%20PublicKeyToken=b03f5f7f11d50a3a&namespa ce=System.Web&class=Htt
pApplication

You should also look at System.Web.HttpContext :
http://www.csharpfriends.com/quickst...assbrowser/vb/
classbrowser.aspx?assembly=System.Web,%20Version= 1.0.5000.0,%20Culture=n
eutral,%20PublicKeyToken=b03f5f7f11d50a3a&namespa ce=System.Web&class=Htt
pContext


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"Alan Silver" <al*********@nospam.thanx> wrote in message
news:yW**************@nospamthankyou.spam...
Creating classes merely to organise functions is a bit like putting
functions in
organised standard modules in VB6.

Of course, function organization is not the only benefit received from OOP.


No, but in this case, it seems to be the only benefit.
re:
There's nothing inherently OOP about it, it's just a way to put
each on with others of
its kind.

True, but there's absolutely no way to work with OOP
except by using classes, AFAIK. Can you think of one ?


No, but that wasn't what I meant. I meant that this way doesn't seem
to have any
advantages over using a common include file. Therefore, this isn't
really an OOP issue.

I have no problem with putting such functions into a class, I was
just checking if I was
missing something important when I couldn't see any benefit from the
class as opposed to
the include file. It sounds like you're saying that in this case,
there isn't any
specific benefit to a class, it's just a convenient way of doing it.

After posting, I realised that I have one more problem here. Now that
the function has
been moved into a class, how does it get access to things like the
Server object? When
the function was in the .aspx, this was readily available. Now it's
in a class, I guess
I need some way of telling the class that it's going to be in an
ASP.NET page. How do I
do that? Does the class need to inherit from something? If so, what?

Thanks again.

--
Alan Silver
(anything added below this line is nothing to do with me)



--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #13
Alan, you mentioned that youd like to be able to use your global-class
without having to compile it to a DLL. Have you discovered if this is
possible?

regards,
Micah L.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #14
>Alan, you mentioned that youd like to be able to use your global-class
without having to compile it to a DLL. Have you discovered if this is
possible?


I have discovered that it isn't possible ;-)

Having said that, compiling the DLL turned out to be so quick and easy
that it's not a great problem.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #15

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

Similar topics

2
by: lawrence | last post by:
A very strange bug. www.monkeyclaus.org is run by a cms I'm developing. One of types of users we allow is "justTestingTheSite", a type of user I developed to give demo's to prospective clients. The...
88
by: Tim Tyler | last post by:
PHP puts most of its functions into a big flat global namespace. That leads to short function names - but creates a namespace minefield for programmers. Lots of the functions are legacies from...
11
by: Hennie de Nooijer | last post by:
hi thank you for this solution Hugo (dutch?) and it's very handy, thank you but my issue is that we created dozens of views with my function. This functions returns an integer of a date. This...
11
by: Capstar | last post by:
Hi, I am working on an application, which will run embedded without an OS. The app is build up out of a couple of well defined parts. At first I wanted to keep those parts seperated and use...
687
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't...
7
by: Michael | last post by:
Hi newsgroup, as the subject indicates I am looking for an advice using global variables. I am not if this problem is more about style then C. If its wrong in thi group, sorry. So I have a...
6
by: Joe Befumo | last post by:
I just created the default personal site project in Visual Studio 2005, and it worked perfectly -- very nice. Next, I'd like to import some stat-capture code that I have working in a Visual Studio...
10
by: Charles O'Flynn | last post by:
As a complete newcomer (2-3 days) to PHP, although not to programming in general, I have 'dived in' to start a small project to read and parse an XML data stream. I have already worked out most of...
1
weaknessforcats
by: weaknessforcats | last post by:
C++: The Case Against Global Variables Summary This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.