PDA

Click to See Complete Forum and Search --> : How to add and include file or module to ASP.net page


dgruzew
Sep 13th, 2002, 10:35 AM
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???

SoftwareMaker
Sep 13th, 2002, 11:55 PM
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

dgruzew
Sep 15th, 2002, 12:49 PM
how about response and request objects??

SoftwareMaker
Sep 15th, 2002, 05:12 PM
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

courchjo
Aug 19th, 2003, 11:51 AM
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

hellswraith
Aug 19th, 2003, 12:12 PM
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.

SoftwareMaker
Aug 19th, 2003, 06:56 PM
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

courchjo
Aug 20th, 2003, 08:27 AM
Hey, Thanks the context.current.session("Current Variable") did the trick!