Results 1 to 8 of 8

Thread: How to add and include file or module to ASP.net page

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Location
    Chicago
    Posts
    30

    How to add and include file or module to ASP.net page

    Hi,

    Does anyone no how to add include style file to an aspx page?? I want a function that I can share with all of my pages , I cannot use a module or class(.vb) file beause I need to use the response and request and session objects (they don't seem to be available in these file types ) I am using the code behind pages

    mabye there is a namespace I can use??? in a class.vb ???

    Any ideas???

  2. #2
    Hyperactive Member SoftwareMaker's Avatar
    Join Date
    Mar 2001
    Location
    Elbonia with Dilbert and Wally
    Posts
    322
    You can still use a vb.net class to be shared with all your other pages. You can still use your session or application variables with the HTTPApplication class imports within the vb.net class. From there, go to the context object and retrieve your session or application variables from there.

    hth
    William T
    Software Architect / Chief Software Developer
    Softwaremaker.Net Pte Ltd
    http://www.Softwaremaker.net

    *** Things are always the darkest before they go pitch black ***

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Location
    Chicago
    Posts
    30

    response and request?

    how about response and request objects??

  4. #4
    Hyperactive Member SoftwareMaker's Avatar
    Join Date
    Mar 2001
    Location
    Elbonia with Dilbert and Wally
    Posts
    322
    Create a vb.net class in your web app project and then inherit your web form class. Everything that is available in your web form page will be available in your vb.net class
    William T
    Software Architect / Chief Software Developer
    Softwaremaker.Net Pte Ltd
    http://www.Softwaremaker.net

    *** Things are always the darkest before they go pitch black ***

  5. #5
    Addicted Member
    Join Date
    Apr 1999
    Location
    Atlanta
    Posts
    145
    Hey, I was trying to use the response.redirect from a class after inheriting the webform and got the following error:
    "Response is not available in this context."

    the class looks like this:

    Public Class checkstatus
    Inherits Userhome

    Sub checklogin()
    If Session("LoggedIn") <> "Y" Then
    Response.Redirect("index.aspx")
    End If
    End Sub
    End Class

  6. #6
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    you can create a web user control that has the functionality you require in it's code behind file. As long as you don't include any html in the design of it, it will display when rendered as nothing. Then you can just drop it on each page.

  7. #7
    Hyperactive Member SoftwareMaker's Avatar
    Join Date
    Mar 2001
    Location
    Elbonia with Dilbert and Wally
    Posts
    322
    Hey, I was trying to use the response.redirect from a class after inheriting the webform and got the following error:
    You have to use the WEB namespace and then after that use the context.current to use the current context web variables.

    current.context.Session("CurrentVariable")

    hth
    William T
    Software Architect / Chief Software Developer
    Softwaremaker.Net Pte Ltd
    http://www.Softwaremaker.net

    *** Things are always the darkest before they go pitch black ***

  8. #8
    Addicted Member
    Join Date
    Apr 1999
    Location
    Atlanta
    Posts
    145
    Hey, Thanks the context.current.session("Current Variable") did the trick!

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