Im trying to write a class that will encapsulate a bunch of response and request calls Im doing. In the class, I deal with querystrings, read and write cookies, and will eventually be doing some SQL stuff...
Right now, Im 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:
Those two properties would set private data members inside the class equal to response and request.
This didnt 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 didnt 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 doesnt matter if I try and reference request in the class by "request," "me.request," or "mybase.request"; the error is the same.
I also tried, in my new sub, setting the private myRequest and myResponse members to System.Web.HttpContext.Current.Request/Response. This has the same effect as my first attempt.
Im sure Im doing something wrong...Ive never written something like this before, and I really have little idea what Im doing.
The question, however, is: what?
Can anyone help me?
Right now, Im 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:
Code:
Dim Refs as new Referrences
Refs.response = response
Refs.request = request
This didnt 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 didnt 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 doesnt matter if I try and reference request in the class by "request," "me.request," or "mybase.request"; the error is the same.
I also tried, in my new sub, setting the private myRequest and myResponse members to System.Web.HttpContext.Current.Request/Response. This has the same effect as my first attempt.
Im sure Im doing something wrong...Ive never written something like this before, and I really have little idea what Im doing.
The question, however, is: what?
Can anyone help me?