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

Using Response/Request in Custom Controls

I am trying to use the the response and request objects in my custom
control, but I keep getting an error that the objects have not been
referenced. I have put in a using statement for System.Web to gain access to
HttpRequest and HttpResponse, but that is really not helping. Can someone
please give me some insight here?
Nov 15 '05 #1
6 2082
Jeremy,

The Request and the Response are not exposed by the Control class.
Rather, you can get them through the Page property, or you can get them
through the HttpContext instance returned by the static Current property on
the HttpContext class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeremy Ames" <yo******@here.com> wrote in message
news:O8**************@TK2MSFTNGP10.phx.gbl...
I am trying to use the the response and request objects in my custom
control, but I keep getting an error that the objects have not been
referenced. I have put in a using statement for System.Web to gain access to HttpRequest and HttpResponse, but that is really not helping. Can someone
please give me some insight here?

Nov 15 '05 #2
Can you give an example? I have tried using Page.Response and Page.Request
but I get another error.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eV**************@TK2MSFTNGP11.phx.gbl...
Jeremy,

The Request and the Response are not exposed by the Control class.
Rather, you can get them through the Page property, or you can get them
through the HttpContext instance returned by the static Current property on
the HttpContext class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeremy Ames" <yo******@here.com> wrote in message
news:O8**************@TK2MSFTNGP10.phx.gbl...
I am trying to use the the response and request objects in my custom
control, but I keep getting an error that the objects have not been
referenced. I have put in a using statement for System.Web to gain access to HttpRequest and HttpResponse, but that is really not helping. Can someone
please give me some insight here?


Nov 15 '05 #3
Jeremy,

Can you be more specific about the error you are getting?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeremy Ames" <yo******@here.com> wrote in message
news:Oc**************@TK2MSFTNGP10.phx.gbl...
Can you give an example? I have tried using Page.Response and Page.Request
but I get another error.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:eV**************@TK2MSFTNGP11.phx.gbl...
Jeremy,

The Request and the Response are not exposed by the Control class.
Rather, you can get them through the Page property, or you can get them
through the HttpContext instance returned by the static Current property on the HttpContext class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeremy Ames" <yo******@here.com> wrote in message
news:O8**************@TK2MSFTNGP10.phx.gbl...
I am trying to use the the response and request objects in my custom
control, but I keep getting an error that the objects have not been
referenced. I have put in a using statement for System.Web to gain access
to
HttpRequest and HttpResponse, but that is really not helping. Can

someone please give me some insight here?


Nov 15 '05 #4
The error message I am getting when using
Page.Request.ServerVariables["Script_Name"] is "Object reference not set to
an instance of an object."

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ul**************@TK2MSFTNGP12.phx.gbl...
Jeremy,

Can you be more specific about the error you are getting?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeremy Ames" <yo******@here.com> wrote in message
news:Oc**************@TK2MSFTNGP10.phx.gbl...
Can you give an example? I have tried using Page.Response and Page.Request
but I get another error.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:eV**************@TK2MSFTNGP11.phx.gbl...
Jeremy,

The Request and the Response are not exposed by the Control class.
Rather, you can get them through the Page property, or you can get them
through the HttpContext instance returned by the static Current property on the HttpContext class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeremy Ames" <yo******@here.com> wrote in message
news:O8**************@TK2MSFTNGP10.phx.gbl...
I am trying to use the the response and request objects in my custom
control, but I keep getting an error that the objects have not been
referenced. I have put in a using statement for System.Web to gain access
to
HttpRequest and HttpResponse, but that is really not helping. Can

someone please give me some insight here?



Nov 15 '05 #5
Jeremy,

This means that "Script_Name" doesn't return a key. This is different
from the property not existing. Are you sure that the key points to a valid
value?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeremy Ames" <yo******@here.com> wrote in message
news:uy**************@tk2msftngp13.phx.gbl...
The error message I am getting when using
Page.Request.ServerVariables["Script_Name"] is "Object reference not set to an instance of an object."

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:ul**************@TK2MSFTNGP12.phx.gbl...
Jeremy,

Can you be more specific about the error you are getting?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeremy Ames" <yo******@here.com> wrote in message
news:Oc**************@TK2MSFTNGP10.phx.gbl...
Can you give an example? I have tried using Page.Response and Page.Request
but I get another error.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote

in
message news:eV**************@TK2MSFTNGP11.phx.gbl...
Jeremy,

The Request and the Response are not exposed by the Control class.
Rather, you can get them through the Page property, or you can get them
through the HttpContext instance returned by the static Current property

on
the HttpContext class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeremy Ames" <yo******@here.com> wrote in message
news:O8**************@TK2MSFTNGP10.phx.gbl...
I am trying to use the the response and request objects in my custom
control, but I keep getting an error that the objects have not been
referenced. I have put in a using statement for System.Web to gain

access
to
HttpRequest and HttpResponse, but that is really not helping. Can

someone please give me some insight here?



Nov 15 '05 #6
Actually, that was supposed to say "Server_Name"

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ed**************@tk2msftngp13.phx.gbl...
Jeremy,

This means that "Script_Name" doesn't return a key. This is different
from the property not existing. Are you sure that the key points to a valid
value?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeremy Ames" <yo******@here.com> wrote in message
news:uy**************@tk2msftngp13.phx.gbl...
The error message I am getting when using
Page.Request.ServerVariables["Script_Name"] is "Object reference not set to an instance of an object."

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:ul**************@TK2MSFTNGP12.phx.gbl...
Jeremy,

Can you be more specific about the error you are getting?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeremy Ames" <yo******@here.com> wrote in message
news:Oc**************@TK2MSFTNGP10.phx.gbl...
Can you give an example? I have tried using Page.Response and Page.Request
but I get another error.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote

in
message news:eV**************@TK2MSFTNGP11.phx.gbl...
Jeremy,

The Request and the Response are not exposed by the Control class.
Rather, you can get them through the Page property, or you can get them
through the HttpContext instance returned by the static Current property

on
the HttpContext class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jeremy Ames" <yo******@here.com> wrote in message
news:O8**************@TK2MSFTNGP10.phx.gbl...
I am trying to use the the response and request objects in my custom
control, but I keep getting an error that the objects have not been
referenced. I have put in a using statement for System.Web to gain

access
to
HttpRequest and HttpResponse, but that is really not helping. Can

someone please give me some insight here?




Nov 15 '05 #7

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

Similar topics

10
by: Anthony Williams | last post by:
Hi gang, This one looks like a bug :o( As you may or may not know, setting session management in web.config to use cookieless sessions causes the ASP.NET runtime to munge a session ID into...
10
by: George G. | last post by:
Hi there, I am busy writing a new asp.net application and I am reusing some of my existing asp functions and methods in a user control. I need access to session, request and response in some of...
3
by: Hitesh | last post by:
Hi, I am getting the response from another Website by using the HttpHandler in my current site. I am getting the page but all the images on that page are not appearing only placeholder are...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
1
by: rushikesh.joshi | last post by:
Hi All, I want some charting functionality in my ASP.NET application. I want to show a multiple bar on my web page. It's based on down time of different servers. like server1: down betn 4 AM...
4
by: s.bussing | last post by:
Hi All, I'm new to Atlas and I did some programming using AJAX, but I'm wondering if it is possible to hava a javascript which can call a server-site function, in my case to write data to the...
2
by: BobLaughland | last post by:
Hi There, I need a control on my site that is a hyperlink style control, but it must, 1) Have a property that can hold where the hyperlink is pointing to. (e.g. like the NavigateUrl property...
8
by: inpuarg | last post by:
I 'm developing a c# (.net 2.0) windows forms application and in this application i want to connect to a java servlet page (HTTPS) (which is servlet 2.4 and which may be using Web Based SSO Sun...
0
by: jb489 | last post by:
Hi all, Hope I am posting this in the right forum. I seem to be having a problem when using serialization and web services. <b>Scenario:</b> I have built a web service which includes a...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.