starwiz
Jul 2nd, 2003, 11:53 AM
I'm trying to write a class that will encapsulate a bunch of response and request calls I'm doing. In the class, I deal with querystrings, read and write cookies, and will eventually be doing some SQL stuff...
Right now, I'm having a problem with using response and request in the class.
Originally, I wrote the class so that after it was created, I could change the request and response objects through properties. The code would look like this from calling the class:
Dim Refs as new Referrences
Refs.response = response
Refs.request = request
Those two properties would set private data members inside the class equal to response and request.
This didn't work.
Any responses or requests I made would work until I left the page. So, for example, I could write and read cookies, so long as both the writing and reading were done on the same page.
After this didn't work, I decided to try making my class inherit system.web.ui.usercontrol. In my new sub, I call mybase.new, so the object should be all created. When I run my program, however, and try to make references to the response or request objects which should be included with the system.web.ui.usercontrol object, I get the error "Object reference not set to an instance of an object." It doesn't matter if I try and reference request in the class by "request," "me.request," or "mybase.request"; the error is the same.
I'm sure I'm doing something wrong...I've never written something like this before.
The question, however, is: what?
Can anyone help me?
Right now, I'm having a problem with using response and request in the class.
Originally, I wrote the class so that after it was created, I could change the request and response objects through properties. The code would look like this from calling the class:
Dim Refs as new Referrences
Refs.response = response
Refs.request = request
Those two properties would set private data members inside the class equal to response and request.
This didn't work.
Any responses or requests I made would work until I left the page. So, for example, I could write and read cookies, so long as both the writing and reading were done on the same page.
After this didn't work, I decided to try making my class inherit system.web.ui.usercontrol. In my new sub, I call mybase.new, so the object should be all created. When I run my program, however, and try to make references to the response or request objects which should be included with the system.web.ui.usercontrol object, I get the error "Object reference not set to an instance of an object." It doesn't matter if I try and reference request in the class by "request," "me.request," or "mybase.request"; the error is the same.
I'm sure I'm doing something wrong...I've never written something like this before.
The question, however, is: what?
Can anyone help me?