Visual Basic .NET » Web Forms
cookie info within ajax method -- ronischuetz --


Request 'Request' threw an exception of type
'System.NullReferenceException' System.Web.HttpRequest
{System.NullReferenceException}

Response 'Response' threw an exception of type
'System.NullReferenceException' System.Web.HttpResponse
{System.NullReferenceException}
in a previous post from michal i read that its possible to read cookie information within my ajax method, somehow i get in cases of request and response always a NullReferneceException...

any idea?

-- AlbertWeinert --


roni schuetz schrieb:
Request 'Request' threw an exception of type
'System.NullReferenceException' System.Web.HttpRequest
{System.NullReferenceException}

Response 'Response' threw an exception of type
'System.NullReferenceException' System.Web.HttpResponse
{System.NullReferenceException}

any idea?

Ronni, please write this 100 times on the chalkboard. 


I have no initialized Page Object within Ajax Request.

*grins*

And use System.Web.HttpContext.Current.Request System.Web.HttpContext.Current.Response

--
Freundliche Grüße

Albert Weinert

http://der-albert.com 

-- MichaelSchwarz --


You can read and write cookies with HttpContext.Current.

Regards Michael

On 7/24/06, Geoffrey Swenson <geoffrey> wrote:

I don't think you can read cookies from AJAX. You are going to have to read
cookies while you are loading the page, and either put the results in hidden
fields or in javascript variables (you can encrypt this if you wish) and
pass them back when you call the AJAX function.

You can also store the cookie data in a database on the server, so all you
would have to pass is a record id.

Geoffrey J. Swenson
geoffrey
-----Original Message-----
From: ajaxpro
On Behalf
Of Albert Weinert
Sent: Sunday, July 23, 2006 10:31 PM
To: ajaxpro
Subject:
Re: cookie info within ajax method
roni schuetz schrieb:
> Request 'Request' threw an exception of type
> 'System.NullReferenceException' System.Web.HttpRequest
> {System.NullReferenceException}
>
> Response 'Response' threw an exception of type
> 'System.NullReferenceException' System.Web.HttpResponse
> {System.NullReferenceException}
>
> any idea?

Ronni, please write this 100 times on the chalkboard.

I have no initialized Page Object within Ajax Request.

*grins*

And use
System.Web.HttpContext.Current.Request
System.Web.HttpContext.Current.Response

--
Freundliche Grüße

Albert Weinert

http://der-albert.com 


>

--  

Best regards | Schöne Grüße Michael

Microsoft MVP - Most Valuable Professional Microsoft MCAD - Certified Application Developer

http://weblogs.asp.net/mschwarz 
/
http://www.schwarz-interactive.de 
/

Skype: callto:schwarz-interactive MSN IM: passport
-- GeoffreySwenson --


I don't think you can read cookies from AJAX. You are going to have to read cookies while you are loading the page, and either put the results in hidden fields or in javascript variables (you can encrypt this if you wish) and pass them back when you call the AJAX function.

You can also store the cookie data in a database on the server, so all you would have to pass is a record id.

Geoffrey J. Swenson geoffrey


-----Original Message-----
From: ajaxpro
Re: cookie info within ajax method
roni schuetz schrieb:
Request 'Request' threw an exception of type
'System.NullReferenceException' System.Web.HttpRequest
{System.NullReferenceException}

Response 'Response' threw an exception of type
'System.NullReferenceException' System.Web.HttpResponse
{System.NullReferenceException}

any idea?

Ronni, please write this 100 times on the chalkboard. 


I have no initialized Page Object within Ajax Request.

*grins*

And use System.Web.HttpContext.Current.Request System.Web.HttpContext.Current.Response

--
Freundliche Grüße

Albert Weinert

http://der-albert.com 



[Submit Comment]Home