error: name 'Request' is not declared

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

The startpage of the application creates a httpCookie:

Dim check As New HttpCookie("ok")
check.Value = "yes"
Response.Cookies.Add(check)


Each page of the application receives that cookie in order to check whether
the user is passed by that startpage:

Dim check As HttpCookie
check = Request.Cookies("ok")
if check.Value="yes" then
.....
else
'exit
....
end if

What i want is to put those lines in a shared sub and so avoiding to have to
put those lines in each page. Each page gets then this: check.checkcookies()

So I put the code in a class:

Public Class check
Public Shared Sub checkcookies()
Dim check As HttpCookie
check = Request.Cookies("ok")
if check.Value="yes" then
....
else
'exit
...
end if
End Sub
End Class


But i have the error: name 'Request' is not declared.

Thanks for help.
Vincent


.



Relevant Pages

  • Re: error: name Request is not declared
    ... The startpage of the application creates a httpCookie: ... Dim check As New HttpCookie ... name 'Request' is not declared. ... Public Shared Sub checkcookies ...
    (microsoft.public.dotnet.languages.vb)
  • Re: error: name Request is not declared
    ... The startpage of the application creates a httpCookie: ... Dim check As New HttpCookie ... name 'Request' is not declared. ... Public Shared Sub checkcookies ...
    (microsoft.public.dotnet.languages.vb)
  • Re: how to make cookies into an array?
    ... Dim allCookies As New Generic.Dictionary(Of String, HttpCookie) ... Dim oneCookie As HttpCookie ... how can i retrieve the cookies? ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Print Records Errors
    ... following in a sub, and got these results ... Dim StartPage, EndPage As Long ... You have to specify the type for every variable listed - you can't specify ...
    (microsoft.public.access.modulesdaovba)
  • Forms Auth Problems.
    ... Dim tkt As FormsAuthenticationTicket ... Dim cookiestr As String ... Dim ck As HttpCookie ...
    (microsoft.public.dotnet.framework.aspnet.security)