how to include in codebehind page?

R

Raymond

Hi All,

In classic ASP I have a include file that reads all cookies and put in variables to be use, in dot net I also have a ASPX file that reads all the cookies, but I am having problem using the file in the codebehind .vb page.

and then I thought I will just create a DLL and put in the bin folder, but I am having problem calling the System.Web.HttpCookie with in the Public Class.

Can any point me to the right direction how I can do this?

Thanks for help

Ray


--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
 
P

Patrice

Hello,
In classic ASP I have a include file that reads all cookies and put in
variables to be use, in dot net I also have a ASPX file that reads all the
cookies, but I am having problem using the file in the codebehind .vb
page.

What have you tried that doesn't work ? Have you tried the samples shown at
http://msdn.microsoft.com/en-us/library/system.web.httpcookie(VS.80).aspx ?
and then I thought I will just create a DLL and put in the bin folder, but
I am having problem calling the System.Web.HttpCookie with in the Public
Class.

You can use System.Web.HttpContext.Current to get access to the current http
request (assuming I understood the question). You still may want to solve
the original issue rather than changing your design just because something
that should work fails...
 
P

Patrice

I realize just now that it could be that you still try to use #include more
than in using cookies ?

If yes and though still supported, you just have to create a class. As
ASP.NET compiles the app in a single DLL, the code you'll put in a class is
usable from all pages.

Please be a bit more specific about what is precisely the problem you get ?
The type of project could perhaps help...
 
R

Ray

I realize just now that it could be that you still try to use #include
more than in using cookies ?

If yes and though still supported, you just have to create a class. As
ASP.NET compiles the app in a single DLL, the code you'll put in a
class is usable from all pages.

Please be a bit more specific about what is precisely the problem you
get ? The type of project could perhaps help...

Thank you Patrice.

Yes, I try to use #include in the aspx page, and it works fine, but for
aspx.vb page, I can not use the #include, and I try to build a public
class and compile it to a DLL, but the compiler is giving me error that
System.Web.HttpCookie doesn't contain any public member.

Imports System
Imports System.Web
Imports System.Web.HttpCookie

Namespace ASPDotNetLB
Public Class LB
Public Sub Load_Cookies()
Dim cookie As New HttpCookie("MyCookieName",
"MyCookieValue")
End Sub
End Class
End Namespace

Raymond
 
R

Ray

Thank you Patrice.

Yes, I try to use #include in the aspx page, and it works fine, but for
aspx.vb page, I can not use the #include, and I try to build a public
class and compile it to a DLL, but the compiler is giving me error that
System.Web.HttpCookie doesn't contain any public member.

Imports System
Imports System.Web
Imports System.Web.HttpCookie

Namespace ASPDotNetLB
Public Class LB
Public Sub Load_Cookies()
Dim cookie As New HttpCookie("MyCookieName",
"MyCookieValue")
End Sub
End Class
End Namespace

Raymond

Never mind, I got it working.
Thanks for help.

Raymond
 
G

Gregory A. Beamer

Raymond said:
Hi All,

In classic ASP I have a include file that reads all cookies and put in
variables to be use, in dot net I also have a ASPX file that reads all the
cookies, but I am having problem using the file in the codebehind .vb
page.

and then I thought I will just create a DLL and put in the bin folder, but
I am having problem calling the System.Web.HttpCookie with in the Public
Class.

Can any point me to the right direction how I can do this?

Pass the cookie to the library, if you want to work at it there. You also
have to have add the proper namespace declarations to the class file and
reference the web bits.

--
Peace and Grace,
Greg

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

************************************************
| Think outside the box! |
************************************************
 
R

Ray

Pass the cookie to the library, if you want to work at it there. You
also have to have add the proper namespace declarations to the class
file and reference the web bits.

Thank you Greg, I got it working already.

Raymond
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top