Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP.NET (Non-Forum Related)
 C# request cookies problem...
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

alextam
Starting Member

Hong Kong
42 Posts

Posted - 13 September 2003 :  12:40:03  Show Profile  Visit alextam's Homepage  Send alextam an ICQ Message
Hi, it's me again...

This time i have a problem with requesting cookies in C#.
I have stored a cookies name "username" and how can i correctly get back the value? I wrote the following but it returns error.

private string DefaultImageFolder = "" + Request.Cookies["username"].Value.ToString();


Errors:
CS0118: 'System.Web.UI.Page.Request' denotes a 'property' where a 'class' was expected.


Please help~~
thanks~~~

Thanks a lot!
Regards.

Nathan
Help Moderator

USA
7664 Posts

Posted - 16 September 2003 :  14:50:44  Show Profile  Visit Nathan's Homepage
private string DefaultImageFolder;
DefaultImageFolder = this.Request.Cookies["username"].ToString();

Try that.

Nathan Bales
CoreBoard | Active Users Download
Go to Top of Page

alextam
Starting Member

Hong Kong
42 Posts

Posted - 17 September 2003 :  02:37:01  Show Profile  Visit alextam's Homepage  Send alextam an ICQ Message
sorry...
what's the use of
this
here?
thanks~

Thanks a lot!
Regards.
Go to Top of Page

Nathan
Help Moderator

USA
7664 Posts

Posted - 17 September 2003 :  03:48:07  Show Profile  Visit Nathan's Homepage
this isn't really needed. I just put it in out of habbit.

The 'this' just is a self reference. It makes sure that "Request" belongs to the current instance of whichever class your putting the code in.

Nathan Bales
CoreBoard | Active Users Download
Go to Top of Page

alextam
Starting Member

Hong Kong
42 Posts

Posted - 17 September 2003 :  22:48:08  Show Profile  Visit alextam's Homepage  Send alextam an ICQ Message
oh i see.
Thanks~

Thanks a lot!
Regards.
Go to Top of Page

Nathan
Help Moderator

USA
7664 Posts

Posted - 18 September 2003 :  03:21:24  Show Profile  Visit Nathan's Homepage
Did it work? I didn't expect it to . . .

Nathan Bales
CoreBoard | Active Users Download
Go to Top of Page

alextam
Starting Member

Hong Kong
42 Posts

Posted - 18 September 2003 :  22:36:00  Show Profile  Visit alextam's Homepage  Send alextam an ICQ Message
Sorry for the late reply, Nathan. I have solved the problem but not relating to "this". I will post the code after back home~~

Thanks all~

Thanks a lot!
Regards.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.25 seconds. Powered By: Snitz Forums 2000 Version 3.4.07