Well, that's correct. How can you read a cookie when it doesn't
even exist yet!
Remember, the ASP.NET code is processed on the server and rendered
as HTML. So if you are setting a cookie from the RENDERED html
page, the ASP.NET code won't see the cookie until the page is posted
back to the server.
Try placing the Request.Cookies() call in a postback IF..END IF statement.
Dallas
Quoting Mike Appenzellar <[EMAIL PROTECTED]>:
> I have the code:
>
> <script language="javascript">
> document.cookie = "em_styleSheet=styles";
> </script>
> <asp:Literal id="LiteralTest" runat="server"></asp:Literal>
> ________________________
>
> LiteralTest.Text = Request.Cookies("em_styleSheet").Value
> ________________________
>
> And it does'nt work? I get "Object reference not set to an instance of
> an object."
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12hdbc9am/M=362131.6882499.7825260.1510227/D=groups/S=1705006764:TM/Y=YAHOO/EXP=1123879314/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/