Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 6th, 2005, 12:13 PM
Registered User
 
Join Date: Apr 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Custom Class

Hi, i am trying to write a custom class (i.e. the ones you compile to a dll) in vb.net, to talk to be able to write cookies, but i am having mucho problems.
Correct me if i'm wrong; but as i gather you need to be able to access httprespone and request, but i am having problem in accessing them from the custom class (i.e. it won't compile). I get the impression they are apart of the page object, but as the code isn't in a page, how do i access them, I saw something about inheritance, i get the idea about that (use it in C++) but don't now how to implement it in this.... If thats the way to do it.
-Thanks for any help.

oh yeah, here's some code. This is the code i have currently in each page, i am trying to get that into a method in a custom class.
Code:
function getStyle() As String
    Dim sStyle As String
        if Request.Cookies("css") Is Nothing Then
           sStyle = "normal"
           return sStyle
        else

           sStyle =  Request.Cookies("css").Value
           return sStyle

        end if
End function
 
Old April 10th, 2005, 03:30 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Unless you actually need to create a class that is derived from "System.Web.UI.Page" you don't need to use inheritance. Fortunately, .NET has provided a way to get at the current response and request objects:

System.Web.HttpContext.Current

This will get you the currently executing Http request. Off of that you can get to response, request, session, etc.

http://msdn.microsoft.com/library/de...rrenttopic.asp

-Peter
 
Old April 10th, 2005, 05:16 PM
Registered User
 
Join Date: Apr 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sweet! Thanks a lot, i'll give that a go..!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom style class oldSkool BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 0 January 9th, 2007 03:39 AM
Custom Default Class Template Bob Bedell C# 3 November 11th, 2006 03:18 PM
Ajax and Custom Class ~Bean~ ASP.NET 1.0 and 1.1 Professional 0 April 6th, 2006 12:33 PM
creating an event for a custom class? lkubler BOOK: Beginning Access 2003 VBA 3 September 20th, 2005 03:47 PM
DataRow Vs Custom Class RM82 BOOK: ASP.NET Website Programming Problem-Design-Solution 2 April 3rd, 2004 06:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.