Wrox Programmer Forums
|
BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4
This is the forum to discuss the Wrox book Beginning Dreamweaver MX by Charles E. Brown, Imar Spaanjaars, Todd Marks; ISBN: 9780764544040
Please indicate which version of the book you are using when posting questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 16th, 2004, 04:14 AM
Authorized User
 
Join Date: Sep 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginning Dreamweaver MX - 8201- Page - 294

I have been referring the Beginning Dreamweaver MX book (ISBN - 1-86100-820-1).

Problem:
In Chapter 8, the code in the section Try it out - Adding Code to the global.asa File (page 294) is not working for me. It is not calculating the time from the start of the session, but calculates it from 12:00:00 AM. For debugging, I tried to display the value of the Session("StartTime") variable in home.asp. It shows empty.

The global.asa file is created directly under C:/TheSoccerSite (the root directory).

For your reference I have copied the code exactly as given in both - the global.asa file and in the home.asp page.

The code in the global.asa file contains:

<script language="vbscript" runat="server">
Sub Session_OnStart
Session("StartTime") = Now()
End Sub

Sub Session_OnEnd

End Sub
</script>


The related code in the home.asp file contains:

 Welcome, <%= Session("UserName") %>!
  <p>Session("StartTime") contains <%= Session("StartTime") %> </p>
  <p>You have been browsing this site since <%= Session("StartTime") %> </p>
  which was <%= datediff("S", Session("StartTime"), Now()) %>
  seconds ago.
  <% End If %>

Is it because my global.asa file is not working properly? Or is it because my Session is not started properly?

I am using Windows Me with Personal Web Server.

Please help as I am stuck with this problem for a long time.


Shubhada.

 
Old March 16th, 2004, 04:18 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Shubhada,

Do other Session variable work? That is, does

Welcome, <%= Session("UserName") %>!

display your name when you have entered your name on the home page?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 16th, 2004, 06:52 AM
Authorized User
 
Join Date: Sep 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, the other session variable works just fine!
Welcome, <%= Session("UserName") %>!
displays the name correctly.

 
Old March 16th, 2004, 07:04 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

This is really odd. Are you getting a very large number of seconds for the DateDiff result?

That would indicate that the start date is not set correctly in the global.asa file.

Would you mind posting the entire code for the global.asa file so I can take a look? You may also want to add the relevant parts of the page that displays the name and number of seconds you have been browsing the site.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 16th, 2004, 08:39 AM
Authorized User
 
Join Date: Sep 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar!

The code I have submitted before is the entire code for my global.asa file.

Yes, I am getting a very large number of seconds for the datediff result.

I have addted Now() and Session("StartTime") variable displays for debugging purpose.

My homepage looks like this in the browser:
----------------------------------------------
Welcome to GlobalSoccerEvents.com
Your source for Soccer Events Around the Globe.


Welcome, Shubhada!
The time now is: 4:36:02 PM

Now() contains 3/16/2004 4:36:02 PM

Session("StartTime") contains

You have been browsing this site since

which was 3288616562 seconds ago.

----------------------------------------------

The relevant code for this part of the display is as follows:

----------------------------------------------
 <p>Your source for Soccer Events Around the Globe.</p>
 <br>
 <%
    If Session("UserName") = "" Then %>
       Please enter your name and hit "Tell Us Your Name" button.<br>
       <form action="home.asp" method="post" name="frmUserName" id="frmUserName">
        <label>
        <input name="txtUserName" type="text" id="txtUserName">
        <input name="btnSubmit" type="submit" id="btnSubmit" value="Tell Us Your Name">
        </label>
      </form>
     <% Else %>
     Welcome, <%= Session("UserName") %>!
     <p>The time now is: <%= Time %> </p>
     <p>Now() contains <%= Now() %> </p>
     <p>Session("StartTime") contains <%= Session("StartTime") %> </p>
     <p>You have been browsing this site since <%= Session("StartTime") %> </p>
     which was <%= datediff("S", Session("StartTime"), Now()) %>
     seconds ago.
     <% End If %>
----------------------------------------------
----------------------------------------------
Shubhada.



 
Old March 16th, 2004, 08:45 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

It looks like the Session_OnStart doesn't fire, but that Sessions otherwise are working normally.

Did you change the Application folder into a real PWS Application? Did you grant the application Execute rights in the PWS manager?

Check out this article for more info. Maybe it helps.....
[Right, I am sure you want the link as well ;) ]
http://support.microsoft.com/default...b;EN-US;184572


Cheers,

Imar

Edited to add the link.

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 16th, 2004, 09:10 AM
Authorized User
 
Join Date: Sep 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar!

There is no Application folder in the PWS Application. Only following folders are there:

Home -->
        /IISADMIN
        /IISHELP
        /IISSAMPLES
        /New Virtual Directory
        /SCRIPTS
        /WEBPUB

Out of these, only /New Virtual Directory and /SCRIPTS have been given the Execute rights.

I will check the Microsoft link presently.

Shubhada.



 
Old March 16th, 2004, 09:24 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Shubhada,

There is no need for an application folder. What's important is that the folder where your site is located is *marked* as an application. I am not too familiar with PWS, but AFAIK, you should enable the Execute permission to allow PWS to execute stuff in the Global.asa.

Where is your global.asa for the application stored.Where is home.asp stored?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 16th, 2004, 09:39 AM
Authorized User
 
Join Date: Sep 2003
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar!

Thanks a lot for your help. The article you sent did solve my problem. You were right. My site was not marked as an application. As given in the article I added my site as an Application in the Persobal Web Server. Gave it an execute permission. (actually I gave all the three permissions - Read, Execute and Scripts). Now The Session("StartTime") is displayed correctly and the number of seconds since the site is being browsed is reasonable - like 10-15 seconds.

Thanks for all the help and your prompt response.

Shubhada.

(P.S. for reference - my global.asa file and the home.asp file both are in the root directory.

C:\TheSoccerSite\home.asp
and
C:\TheSoccerSite\global.asa)



 
Old March 16th, 2004, 09:46 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hurrah!!

Glad it worked out.

Have fun with the rest of the book.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning Dreamweaver MX 2004 - Page 73 ColinS Dreamweaver (all versions) 4 May 14th, 2005 02:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.