Click here to Skip to main content
15,896,522 members
Home / Discussions / C#
   

C#

 
GeneralRe: notify if tab-key is pressed Pin
Anonymous24-Jul-02 11:11
Anonymous24-Jul-02 11:11 
GeneralRe: notify if tab-key is pressed Pin
Luis Alonso Ramos24-Jul-02 11:41
Luis Alonso Ramos24-Jul-02 11:41 
QuestionHighlighting in RichTextBox? Pin
leppie24-Jul-02 3:58
leppie24-Jul-02 3:58 
AnswerRe: Highlighting in RichTextBox? Pin
jparsons24-Jul-02 4:36
jparsons24-Jul-02 4:36 
GeneralRe: Highlighting in RichTextBox? Pin
leppie24-Jul-02 5:17
leppie24-Jul-02 5:17 
GeneralComboBox - MultiColumn Pin
mikasa24-Jul-02 2:53
mikasa24-Jul-02 2:53 
GeneralRe: ComboBox - MultiColumn Pin
David Stone24-Jul-02 12:37
sitebuilderDavid Stone24-Jul-02 12:37 
GeneralChanging Cookie Values by calling class functions Pin
Sassan Komeili Zadeh23-Jul-02 23:37
Sassan Komeili Zadeh23-Jul-02 23:37 
I am developing an eShop with ASP.NET and my IDE is Visual Studio .NET. I want to use Cookie to keep Shop Cart information at client side. I also defined a class and some functions to work with them, for example adding an item to Cookie (Shop Cart), updating items and deleting an item.

But when I use these functions, no changes apply to the cookie value.
I think it is because the class doesn't have access to change Response and Request of Page.

Please let me know how I can solve this problem.

Here is the code I developed (Unnecessary parts are not shown.)
C# Class:
public class ShopCart
{
/*
...
*/

/******************** Cookie Remove_Name ******************/
// Removes an Item from Cookie
public void Remove_Name(HttpRequest thisReq, String Cookie_Name, String sName)
{
HttpCookieCollection MyCookieColl;
HttpCookie MyCookie;

MyCookieColl = thisReq.Cookies;

MyCookie = MyCookieColl[Cookie_Name];
if (MyCookie!=null)
{
if (MyCookie.Values.Get(sName)!=null)
{
MyCookie.Values.Remove(sName);
Response.Cookies.Add(MyCookie);
}
}
}
} // class

ASP.NET Call script:
ShopCart myShopCart = new ShopCarts.ShopCart();
myShopCart.Remove_Name(Request, "eShopCart", "item_01"

Look forward to hearing from you all.

Sassan
Generalmultiple updates Pin
Sarith Sutha23-Jul-02 19:48
Sarith Sutha23-Jul-02 19:48 
GeneralRe: multiple updates Pin
SimonS23-Jul-02 23:00
SimonS23-Jul-02 23:00 
GeneralRe: multiple updates Pin
Sarith Sutha24-Jul-02 3:14
Sarith Sutha24-Jul-02 3:14 
GeneralRe: multiple updates Pin
jparsons24-Jul-02 4:12
jparsons24-Jul-02 4:12 
GeneralRe: multiple updates Pin
Sarith Sutha24-Jul-02 18:50
Sarith Sutha24-Jul-02 18:50 
GeneralRe: multiple updates Pin
David Stone24-Jul-02 12:39
sitebuilderDavid Stone24-Jul-02 12:39 
GeneralRe: multiple updates Pin
SimonS24-Jul-02 21:37
SimonS24-Jul-02 21:37 
GeneralRe: multiple updates Pin
leppie24-Jul-02 23:03
leppie24-Jul-02 23:03 
GeneralRe: multiple updates Pin
SimonS24-Jul-02 21:33
SimonS24-Jul-02 21:33 
GeneralRe: multiple updates Pin
Sarith Sutha24-Jul-02 22:19
Sarith Sutha24-Jul-02 22:19 
GeneralRe: multiple updates Pin
SimonS24-Jul-02 23:09
SimonS24-Jul-02 23:09 
GeneralUsing current user credentials with Task Scheduler Library Pin
Keith Mai23-Jul-02 13:17
Keith Mai23-Jul-02 13:17 
Generalnetmodules Pin
jparsons23-Jul-02 10:37
jparsons23-Jul-02 10:37 
GeneralRe: netmodules Pin
Eric Gunnerson (msft)24-Jul-02 5:33
Eric Gunnerson (msft)24-Jul-02 5:33 
GeneralRe: netmodules Pin
jparsons24-Jul-02 5:50
jparsons24-Jul-02 5:50 
GeneralRe: netmodules Pin
Eric Gunnerson (msft)24-Jul-02 9:53
Eric Gunnerson (msft)24-Jul-02 9:53 
GeneralRe: netmodules Pin
jparsons25-Jul-02 3:01
jparsons25-Jul-02 3:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.