Session & Service keywords conflict....

  • Thread starter Thread starter Dhruba Bandopadhyay
  • Start date 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?
 
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.
 
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.
 
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
 
Back
Top