Session & Service keywords conflict....

  • Thread starter Dhruba Bandopadhyay
  • Start date
D

Dhruba Bandopadhyay

I am a current ASP developer.

I have files: ServiceClass.asp & SessionClass.asp which are included in many
of my asp files. Then they call objService = New Service (by using the Class
Service from ServiceClass.asp file).

Is it true that ASP.NET does not allow you to use Service or Session words
as they are keywords in ASP.NET?
 
M

Marina Levit [MVP]

No, it is not true. Neither is a VB.NET keyword. And there is no such thing
as an 'ASP.NET keyword' because you are always writing your code in some
language, so all the keywords are keywords of that language.

There is a Session property of the Page class. I don't know about Service,
I don't remember seeing one. In any case, you can still call classes
Session and Service, you may just end up doing a little more typing so the
compiler can differentiate them.
 
S

sloan

If there is a naming conflict, you have to use the fully qualified object
name sometimes.

Aka..if you code up a page.. and

you create a namespace/object called

MyApplication.EventArgs.MySomethingEventArgs (where MySomethingEventArgs is
the object name)(and MyApplication.EventArgs is the namespace)


and then you want to use the Microsoft .... System.EventArgs
System.EventArgs

You'll have to code your object as

MyApplication.EventArgs.MySomethingEventArgs abc = new
MyApplication.EventArgs.MySomethingEventArgs();

instead of the shorthand

MySomethingEventArgs abc = new MySomethingEventArgs();

....

this is why some people will just naturally avoid namespacing
conflicts...but its not Forbidden/unworkable.
 
S

S. Justin Gengo

Dhruba,

If you had used Service.asp or Session.asp you'd have a problem, but I
believe .NET will not give you any trouble with ServiceClass or SessionClass
those will be treated as a different object.

Regards,

--
S. Justin Gengo
Web Developer / Programmer

Free code library:
http://www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top