barski Posted August 17, 2003 Posted August 17, 2003 Is there anyway to request cookies from a component file. I'm using 3 cookies to verify certain things every time the user opens a new webform. It works great but currently I have to add that routine to every webform I add. Is there a way to put the routine in a component file so all I have to do is create a new instance and call the routine Quote
*Experts* Bucky Posted August 17, 2003 *Experts* Posted August 17, 2003 If you don't need an instance of a class to use the method, you can call it as a shared (static in C#) method of a class. Add a new class to your project, and add the method as Public Shared (public static in C#), then you can call it anywhere in your project by using ClassName.MethodName(). Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
barski Posted August 18, 2003 Author Posted August 18, 2003 A way of using "Global Routines" Finally!!! But I'm still having trouble with the cookies. I keep getting this error Request is not available in this context Quote
bungpeng Posted August 18, 2003 Posted August 18, 2003 I think I also face the same problem as you. As what I understand, Cookies is available only for Web Application. So my other tiers which using VB or C# developed can't access Cookies... If I inherit it as what Web Form does, logically it should work. But then it is meaningless for my tiers, because it should independent... So please let you know if you got solution. Quote
*Gurus* Derek Stone Posted August 18, 2003 *Gurus* Posted August 18, 2003 HttpContext.Current.Request Quote Posting Guidelines
bungpeng Posted August 18, 2003 Posted August 18, 2003 HttpContext.Current.Request Can I use it in my database layer? it is using either VB.NET or C#. HttpContext is from System.Web right? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.