Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > session variables

Reply
Thread Tools

session variables

 
 
Terry On Windigo
Guest
Posts: n/a
 
      11-05-2006
I think I have figured out my problem but I don't know how to solve it. We
are going to start using a forums package and do not want our users to have
to login to both our site, and then again to the forums package. The
creator of the forums package provides what seems to be an easy workaround
for this. Create two session variables, one for ID, the other for Password,
and his program will take care of the rest.

I have all of my forums package off the root of the drive that has my
Inetpub directory, and within my IIS settings have a virtual directory
pointing to the actual folder. I'm wondering that since my actual forums
folder is outside my IIS, or if its a virtual directors my Session Variables
are not being picked up. I also wonder this for the following reason. On
all of my pages I have

<% If Session("LoggedIn")= "Proceed" Then
Else
Server.Transfer "LoginReturning.asp"
End If
%>

which keeps people from bookmarking and coming back in without logining back
in to the site. However on the forums default.asp page this does not work,
which leads me to believe once again it's a placement issue on my hardrive
with my folders. If I am wrong in my assumptions, and I can do this, how
would I pass the session variable to my default.asp page in my forums
folder? Here is the page that does the checking of my login verification:

<%
Option Explicit
Dim strConnect
%>
<!-- #Include File="Data.asp" -->
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<%

Dim objconn, objrs
Dim lcsql, strName, strEmail, strPassword, Trial, Expiredate,
strCookie2

Set objconn = Server.CreateObject("ADODB.Connection")
Set objrs=Server.CreateObject("ADODB.Recordset")
objconn.open strConnect

Trial = Date

strEmail = request.form("Email")
strPassword = request.form("password")

lcsql="select * FROM results WHERE Email =
'"+request.form("Email")+"' and password = '"+request.form("password")+"'"
objrs.Open lcsql,objconn,0,1,1

'No records returned because user not found

If objrs.EOF then
%>
<Script Language=VBscript>
ReturnItem = msgbox( "Either your name or password was
incorrect, try again.", vbOKOnly, "INCORRECT ENTRY")
</Script>
<%
Server.Transfer "LoginReturning.asp"

else
Session("LoggedIn") = "Proceed"

'The next two session vars are for the forums page
Session("USER") = request.form("Email")
Session("PASSWORD") = request.form("password")
'Check to see that Session variables were indeed assigned
response.write Session("PASSWORD")
response.write Session ("USER")
Server.Transfer "Index.asp"
end if
objrs.Close
objconn.Close
%>

</body>

</html>

Terry


 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      11-05-2006

"Terry On Windigo" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I think I have figured out my problem but I don't know how to solve it.

We
> are going to start using a forums package and do not want our users to

have
> to login to both our site, and then again to the forums package. The
> creator of the forums package provides what seems to be an easy workaround
> for this. Create two session variables, one for ID, the other for

Password,
> and his program will take care of the rest.
>
> I have all of my forums package off the root of the drive that has my
> Inetpub directory, and within my IIS settings have a virtual directory
> pointing to the actual folder. I'm wondering that since my actual forums
> folder is outside my IIS, or if its a virtual directors my Session

Variables
> are not being picked up. I also wonder this for the following reason. On
> all of my pages I have
>
> <% If Session("LoggedIn")= "Proceed" Then
> Else
> Server.Transfer "LoginReturning.asp"
> End If
> %>
>
> which keeps people from bookmarking and coming back in without logining

back
> in to the site. However on the forums default.asp page this does not

work,
> which leads me to believe once again it's a placement issue on my hardrive
> with my folders. If I am wrong in my assumptions, and I can do this, how
> would I pass the session variable to my default.asp page in my forums
> folder? Here is the page that does the checking of my login verification:
>
> <%
> Option Explicit
> Dim strConnect
> %>
> <!-- #Include File="Data.asp" -->
> <html>
> <head>
> <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
> <meta name="ProgId" content="FrontPage.Editor.Document">
> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
> <title>New Page 1</title>
> </head>
> <body>
> <%
>
> Dim objconn, objrs
> Dim lcsql, strName, strEmail, strPassword, Trial, Expiredate,
> strCookie2
>
> Set objconn = Server.CreateObject("ADODB.Connection")
> Set objrs=Server.CreateObject("ADODB.Recordset")
> objconn.open strConnect
>
> Trial = Date
>
> strEmail = request.form("Email")
> strPassword = request.form("password")
>
> lcsql="select * FROM results WHERE Email =
> '"+request.form("Email")+"' and password = '"+request.form("password")+"'"
> objrs.Open lcsql,objconn,0,1,1
>
> 'No records returned because user not found
>
> If objrs.EOF then
> %>
> <Script Language=VBscript>
> ReturnItem = msgbox( "Either your name or password

was
> incorrect, try again.", vbOKOnly, "INCORRECT ENTRY")
> </Script>
> <%
> Server.Transfer "LoginReturning.asp"
>
> else
> Session("LoggedIn") = "Proceed"
>
> 'The next two session vars are for the forums page
> Session("USER") = request.form("Email")
> Session("PASSWORD") = request.form("password")
> 'Check to see that Session variables were indeed assigned
> response.write Session("PASSWORD")
> response.write Session ("USER")
> Server.Transfer "Index.asp"
> end if
> objrs.Close
> objconn.Close
> %>
>
> </body>
>
> </html>
>
> Terry


It isn't a problem of where the folder is placed physically. The fact that
you have made the folder a virtual folder under your own application would
make it part of your application and therefore able to see the session
variables for the app.

The problem most likely is that you have made this virtual folder into an
application in it's own right. Open the properties on the virtual folder
and on the virtual directory tab click the remove button. This stops the
folder from acting as it's own application.



 
Reply With Quote
 
 
 
 
Terry On Windigo
Guest
Posts: n/a
 
      11-06-2006
I really had high hopes that would work, but it didn't. The forums .asp
page isn't picking up the session vars.


"Anthony Jones" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
> "Terry On Windigo" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> I think I have figured out my problem but I don't know how to solve it.

> We
>> are going to start using a forums package and do not want our users to

> have
>> to login to both our site, and then again to the forums package. The
>> creator of the forums package provides what seems to be an easy
>> workaround
>> for this. Create two session variables, one for ID, the other for

> Password,
>> and his program will take care of the rest.
>>
>> I have all of my forums package off the root of the drive that has my
>> Inetpub directory, and within my IIS settings have a virtual directory
>> pointing to the actual folder. I'm wondering that since my actual forums
>> folder is outside my IIS, or if its a virtual directors my Session

> Variables
>> are not being picked up. I also wonder this for the following reason.
>> On
>> all of my pages I have
>>
>> <% If Session("LoggedIn")= "Proceed" Then
>> Else
>> Server.Transfer "LoginReturning.asp"
>> End If
>> %>
>>
>> which keeps people from bookmarking and coming back in without logining

> back
>> in to the site. However on the forums default.asp page this does not

> work,
>> which leads me to believe once again it's a placement issue on my
>> hardrive
>> with my folders. If I am wrong in my assumptions, and I can do this, how
>> would I pass the session variable to my default.asp page in my forums
>> folder? Here is the page that does the checking of my login
>> verification:
>>
>> <%
>> Option Explicit
>> Dim strConnect
>> %>
>> <!-- #Include File="Data.asp" -->
>> <html>
>> <head>
>> <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
>> <meta name="ProgId" content="FrontPage.Editor.Document">
>> <meta http-equiv="Content-Type" content="text/html;
>> charset=windows-1252">
>> <title>New Page 1</title>
>> </head>
>> <body>
>> <%
>>
>> Dim objconn, objrs
>> Dim lcsql, strName, strEmail, strPassword, Trial, Expiredate,
>> strCookie2
>>
>> Set objconn = Server.CreateObject("ADODB.Connection")
>> Set objrs=Server.CreateObject("ADODB.Recordset")
>> objconn.open strConnect
>>
>> Trial = Date
>>
>> strEmail = request.form("Email")
>> strPassword = request.form("password")
>>
>> lcsql="select * FROM results WHERE Email =
>> '"+request.form("Email")+"' and password =
>> '"+request.form("password")+"'"
>> objrs.Open lcsql,objconn,0,1,1
>>
>> 'No records returned because user not found
>>
>> If objrs.EOF then
>> %>
>> <Script Language=VBscript>
>> ReturnItem = msgbox( "Either your name or password

> was
>> incorrect, try again.", vbOKOnly, "INCORRECT ENTRY")
>> </Script>
>> <%
>> Server.Transfer "LoginReturning.asp"
>>
>> else
>> Session("LoggedIn") = "Proceed"
>>
>> 'The next two session vars are for the forums page
>> Session("USER") = request.form("Email")
>> Session("PASSWORD") = request.form("password")
>> 'Check to see that Session variables were indeed
>> assigned
>> response.write Session("PASSWORD")
>> response.write Session ("USER")
>> Server.Transfer "Index.asp"
>> end if
>> objrs.Close
>> objconn.Close
>> %>
>>
>> </body>
>>
>> </html>
>>
>> Terry

>
> It isn't a problem of where the folder is placed physically. The fact
> that
> you have made the folder a virtual folder under your own application would
> make it part of your application and therefore able to see the session
> variables for the app.
>
> The problem most likely is that you have made this virtual folder into an
> application in it's own right. Open the properties on the virtual folder
> and on the virtual directory tab click the remove button. This stops the
> folder from acting as it's own application.
>
>
>



 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      11-06-2006

"Terry On Windigo" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> I think I have figured out my problem but I don't know how to solve it.

We
> are going to start using a forums package and do not want our users to

have
> to login to both our site, and then again to the forums package. The
> creator of the forums package provides what seems to be an easy workaround
> for this. Create two session variables, one for ID, the other for

Password,
> and his program will take care of the rest.
>
> I have all of my forums package off the root of the drive that has my
> Inetpub directory, and within my IIS settings have a virtual directory
> pointing to the actual folder. I'm wondering that since my actual forums
> folder is outside my IIS, or if its a virtual directors my Session

Variables
> are not being picked up. I also wonder this for the following reason. On
> all of my pages I have
>
> <% If Session("LoggedIn")= "Proceed" Then
> Else
> Server.Transfer "LoginReturning.asp"
> End If
> %>
>
> which keeps people from bookmarking and coming back in without logining

back
> in to the site. However on the forums default.asp page this does not

work,
> which leads me to believe once again it's a placement issue on my hardrive
> with my folders. If I am wrong in my assumptions, and I can do this, how
> would I pass the session variable to my default.asp page in my forums
> folder? Here is the page that does the checking of my login verification:
>
> <%
> Option Explicit
> Dim strConnect
> %>
> <!-- #Include File="Data.asp" -->
> <html>
> <head>
> <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
> <meta name="ProgId" content="FrontPage.Editor.Document">
> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
> <title>New Page 1</title>
> </head>
> <body>
> <%
>
> Dim objconn, objrs
> Dim lcsql, strName, strEmail, strPassword, Trial, Expiredate,
> strCookie2
>
> Set objconn = Server.CreateObject("ADODB.Connection")
> Set objrs=Server.CreateObject("ADODB.Recordset")
> objconn.open strConnect
>
> Trial = Date
>
> strEmail = request.form("Email")
> strPassword = request.form("password")
>
> lcsql="select * FROM results WHERE Email =
> '"+request.form("Email")+"' and password = '"+request.form("password")+"'"
> objrs.Open lcsql,objconn,0,1,1
>
> 'No records returned because user not found
>
> If objrs.EOF then
> %>
> <Script Language=VBscript>
> ReturnItem = msgbox( "Either your name or password

was
> incorrect, try again.", vbOKOnly, "INCORRECT ENTRY")
> </Script>
> <%
> Server.Transfer "LoginReturning.asp"
>
> else
> Session("LoggedIn") = "Proceed"
>
> 'The next two session vars are for the forums page
> Session("USER") = request.form("Email")
> Session("PASSWORD") = request.form("password")
> 'Check to see that Session variables were indeed assigned
> response.write Session("PASSWORD")
> response.write Session ("USER")
> Server.Transfer "Index.asp"
> end if
> objrs.Close
> objconn.Close
> %>
>
> </body>
>
> </html>
>
> Terry
>


It sounds like you have set up the virtual directory as an application in
its own right.
In the directories properties on the virtual directory tag click the remove
button to stop the directory acting as an application.

Note the physical location of the folder is not significant.


 
Reply With Quote
 
Slim
Guest
Posts: n/a
 
      11-06-2006

"Terry On Windigo" <(E-Mail Removed)> wrote in message
news:%23%(E-Mail Removed)...
>I really had high hopes that would work, but it didn't. The forums .asp
>page isn't picking up the session vars.



look at the top of your asp page and check that it does not have
EnableSessionState=False

if that is not the case i refere to AJ's advice

>
>
> "Anthony Jones" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>>
>> "Terry On Windigo" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> I think I have figured out my problem but I don't know how to solve it.

>> We
>>> are going to start using a forums package and do not want our users to

>> have
>>> to login to both our site, and then again to the forums package. The
>>> creator of the forums package provides what seems to be an easy
>>> workaround
>>> for this. Create two session variables, one for ID, the other for

>> Password,
>>> and his program will take care of the rest.
>>>
>>> I have all of my forums package off the root of the drive that has my
>>> Inetpub directory, and within my IIS settings have a virtual directory
>>> pointing to the actual folder. I'm wondering that since my actual
>>> forums
>>> folder is outside my IIS, or if its a virtual directors my Session

>> Variables
>>> are not being picked up. I also wonder this for the following reason.
>>> On
>>> all of my pages I have
>>>
>>> <% If Session("LoggedIn")= "Proceed" Then
>>> Else
>>> Server.Transfer "LoginReturning.asp"
>>> End If
>>> %>
>>>
>>> which keeps people from bookmarking and coming back in without logining

>> back
>>> in to the site. However on the forums default.asp page this does not

>> work,
>>> which leads me to believe once again it's a placement issue on my
>>> hardrive
>>> with my folders. If I am wrong in my assumptions, and I can do this,
>>> how
>>> would I pass the session variable to my default.asp page in my forums
>>> folder? Here is the page that does the checking of my login
>>> verification:
>>>
>>> <%
>>> Option Explicit
>>> Dim strConnect
>>> %>
>>> <!-- #Include File="Data.asp" -->
>>> <html>
>>> <head>
>>> <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
>>> <meta name="ProgId" content="FrontPage.Editor.Document">
>>> <meta http-equiv="Content-Type" content="text/html;
>>> charset=windows-1252">
>>> <title>New Page 1</title>
>>> </head>
>>> <body>
>>> <%
>>>
>>> Dim objconn, objrs
>>> Dim lcsql, strName, strEmail, strPassword, Trial, Expiredate,
>>> strCookie2
>>>
>>> Set objconn = Server.CreateObject("ADODB.Connection")
>>> Set objrs=Server.CreateObject("ADODB.Recordset")
>>> objconn.open strConnect
>>>
>>> Trial = Date
>>>
>>> strEmail = request.form("Email")
>>> strPassword = request.form("password")
>>>
>>> lcsql="select * FROM results WHERE Email =
>>> '"+request.form("Email")+"' and password =
>>> '"+request.form("password")+"'"
>>> objrs.Open lcsql,objconn,0,1,1
>>>
>>> 'No records returned because user not found
>>>
>>> If objrs.EOF then
>>> %>
>>> <Script Language=VBscript>
>>> ReturnItem = msgbox( "Either your name or password

>> was
>>> incorrect, try again.", vbOKOnly, "INCORRECT ENTRY")
>>> </Script>
>>> <%
>>> Server.Transfer "LoginReturning.asp"
>>>
>>> else
>>> Session("LoggedIn") = "Proceed"
>>>
>>> 'The next two session vars are for the forums page
>>> Session("USER") = request.form("Email")
>>> Session("PASSWORD") = request.form("password")
>>> 'Check to see that Session variables were indeed
>>> assigned
>>> response.write Session("PASSWORD")
>>> response.write Session ("USER")
>>> Server.Transfer "Index.asp"
>>> end if
>>> objrs.Close
>>> objconn.Close
>>> %>
>>>
>>> </body>
>>>
>>> </html>
>>>
>>> Terry

>>
>> It isn't a problem of where the folder is placed physically. The fact
>> that
>> you have made the folder a virtual folder under your own application
>> would
>> make it part of your application and therefore able to see the session
>> variables for the app.
>>
>> The problem most likely is that you have made this virtual folder into an
>> application in it's own right. Open the properties on the virtual folder
>> and on the virtual directory tab click the remove button. This stops the
>> folder from acting as it's own application.
>>
>>
>>

>
>



 
Reply With Quote
 
Terry On Windigo
Guest
Posts: n/a
 
      11-07-2006
Follow up to those that helped. It is now working for me. The answer was
to stop it running as an application which all of you said. It didn't work
initially, then something clicked in my head and told me to stop and start
IIS. When I did that it worked. You guys really helped me out. I would
never have thought of the correct answer. Thanks, again.

Terry

"Slim" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> "Terry On Windigo" <(E-Mail Removed)> wrote in message
> news:%23%(E-Mail Removed)...
>>I really had high hopes that would work, but it didn't. The forums .asp
>>page isn't picking up the session vars.

>
>
> look at the top of your asp page and check that it does not have
> EnableSessionState=False
>
> if that is not the case i refere to AJ's advice
>
>>
>>
>> "Anthony Jones" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>>
>>> "Terry On Windigo" <(E-Mail Removed)> wrote in message
>>> news:%(E-Mail Removed)...
>>>> I think I have figured out my problem but I don't know how to solve it.
>>> We
>>>> are going to start using a forums package and do not want our users to
>>> have
>>>> to login to both our site, and then again to the forums package. The
>>>> creator of the forums package provides what seems to be an easy
>>>> workaround
>>>> for this. Create two session variables, one for ID, the other for
>>> Password,
>>>> and his program will take care of the rest.
>>>>
>>>> I have all of my forums package off the root of the drive that has my
>>>> Inetpub directory, and within my IIS settings have a virtual directory
>>>> pointing to the actual folder. I'm wondering that since my actual
>>>> forums
>>>> folder is outside my IIS, or if its a virtual directors my Session
>>> Variables
>>>> are not being picked up. I also wonder this for the following reason.
>>>> On
>>>> all of my pages I have
>>>>
>>>> <% If Session("LoggedIn")= "Proceed" Then
>>>> Else
>>>> Server.Transfer "LoginReturning.asp"
>>>> End If
>>>> %>
>>>>
>>>> which keeps people from bookmarking and coming back in without logining
>>> back
>>>> in to the site. However on the forums default.asp page this does not
>>> work,
>>>> which leads me to believe once again it's a placement issue on my
>>>> hardrive
>>>> with my folders. If I am wrong in my assumptions, and I can do this,
>>>> how
>>>> would I pass the session variable to my default.asp page in my forums
>>>> folder? Here is the page that does the checking of my login
>>>> verification:
>>>>
>>>> <%
>>>> Option Explicit
>>>> Dim strConnect
>>>> %>
>>>> <!-- #Include File="Data.asp" -->
>>>> <html>
>>>> <head>
>>>> <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
>>>> <meta name="ProgId" content="FrontPage.Editor.Document">
>>>> <meta http-equiv="Content-Type" content="text/html;
>>>> charset=windows-1252">
>>>> <title>New Page 1</title>
>>>> </head>
>>>> <body>
>>>> <%
>>>>
>>>> Dim objconn, objrs
>>>> Dim lcsql, strName, strEmail, strPassword, Trial, Expiredate,
>>>> strCookie2
>>>>
>>>> Set objconn = Server.CreateObject("ADODB.Connection")
>>>> Set objrs=Server.CreateObject("ADODB.Recordset")
>>>> objconn.open strConnect
>>>>
>>>> Trial = Date
>>>>
>>>> strEmail = request.form("Email")
>>>> strPassword = request.form("password")
>>>>
>>>> lcsql="select * FROM results WHERE Email =
>>>> '"+request.form("Email")+"' and password =
>>>> '"+request.form("password")+"'"
>>>> objrs.Open lcsql,objconn,0,1,1
>>>>
>>>> 'No records returned because user not found
>>>>
>>>> If objrs.EOF then
>>>> %>
>>>> <Script Language=VBscript>
>>>> ReturnItem = msgbox( "Either your name or
>>>> password
>>> was
>>>> incorrect, try again.", vbOKOnly, "INCORRECT ENTRY")
>>>> </Script>
>>>> <%
>>>> Server.Transfer "LoginReturning.asp"
>>>>
>>>> else
>>>> Session("LoggedIn") = "Proceed"
>>>>
>>>> 'The next two session vars are for the forums page
>>>> Session("USER") = request.form("Email")
>>>> Session("PASSWORD") = request.form("password")
>>>> 'Check to see that Session variables were indeed
>>>> assigned
>>>> response.write Session("PASSWORD")
>>>> response.write Session ("USER")
>>>> Server.Transfer "Index.asp"
>>>> end if
>>>> objrs.Close
>>>> objconn.Close
>>>> %>
>>>>
>>>> </body>
>>>>
>>>> </html>
>>>>
>>>> Terry
>>>
>>> It isn't a problem of where the folder is placed physically. The fact
>>> that
>>> you have made the folder a virtual folder under your own application
>>> would
>>> make it part of your application and therefore able to see the session
>>> variables for the app.
>>>
>>> The problem most likely is that you have made this virtual folder into
>>> an
>>> application in it's own right. Open the properties on the virtual
>>> folder
>>> and on the virtual directory tab click the remove button. This stops
>>> the
>>> folder from acting as it's own application.
>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Put variables into member variables or function variables? tjumail@gmail.com C++ 9 03-23-2008 04:03 PM
Session Variables and Static Variables cobus.lombard@gmail.com ASP .Net 1 03-26-2006 11:05 AM
RE: Session Variables assigned to the wrong session? Robert Faulkner ASP .Net 0 01-28-2005 04:16 PM
Session Variables assigned to the wrong session? =?iso-8859-15?Q?Fabr=EDcio_de_Novaes_Kucinskis?= ASP .Net 1 01-20-2005 04:33 PM
Global Session Variables and Session State Earl Teigrob ASP .Net 1 12-17-2003 07:02 AM



Advertisments