Results 1 to 6 of 6

Thread: how can I access Server, or Request in another class?

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    how can I access Server, or Request in another class?

    I made a private class in one of my asp pages. I tried to access the Server and the Request object but it doesnt let me... How can I access it inside a class?

    also, can I put some functions in global.asax and access those functions anywhere? ( I mean can I use the global file just like a public module?)
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    You can't access them. What I have done though, is use those obects to pass in arguments so you have access to the data you need.

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    aha ook I'll do that, heh

    how about the globals file? can it be used like a global module? if I add a public function to it, can I access it from every page? it doesnt LOOK LIKE I can
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I don't think you can, but why would you want to anyway? If it is, I don't know a way.

    You can just create a normal module if your using VB and access it. It would be best this way anyway, because the global module file is for application events, not your custom functions.

  5. #5
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fort Collins, CO
    Posts
    366
    Originally posted by hellswraith
    You can't access them. What I have done though, is use those obects to pass in arguments so you have access to the data you need.
    You can access them thru the HttpContext Class.

    For functionality that is common to all pages what I do is create a base class that inherits from Page and contains the common methods. Then all pages inherit my base class and the common functionality.

  6. #6

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by pvb
    You can access them thru the HttpContext Class.

    For functionality that is common to all pages what I do is create a base class that inherits from Page and contains the common methods. Then all pages inherit my base class and the common functionality.
    aha, good idea and thanks for the link....
    hellswraith thanks I think I'll make a module
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width