Protecting Your Page
Dreamweaver provides you a Server behavior Called Restrict Access to page.
- Open the server behavior panel and Click the plus button and select User Authentication à Restrict Access to page . With this Restrict Access to page dialog box appears on the screen as shown in the Figure-6.26.

Figure-6.26
- Click the Browse button next to the If Access Denied Go to text box. Once you click Ok, Dreamweaver inserts an ASP code block at the top of your page. This is the code which redirects users to when they try to request the other page without having logged in first.
Enabling Session
Sessions are a way to Store information about the specific users on the server. The information we generate through Session can be used in all pages throughout the entire site. Each Unique visitor is assigned with the SessionId and further we use this SessionId as a cookie.
Session consume valuable resources on the server. So, it is always advisable to use as little and do not store large objects.
Before you use Sessions, You must check that your web site can handle whether sessions are enabled or not. Here we are going to mention few steps to enable Sessions.
- Go to Internet information Service from the Administrative Tools category in the control panel.
- Keep your web site folder under Default Web Site as shown in Figure-6.27.

Figure-6.27
- Go to Folder named Company, right click it and choose property.
- As soon you choose property, the property box will appear on the screen as shown in Figure-6.28. Click on the directory tab.

Figure-6.28
- Click on the create button, represented by A as shown in figure6_28. When you click this button, all the details relating to your site will appear in the application settings area of the box as shown in Figure-6.29.

Figure-6.29
You can also remove this site or create new one from the list by clicking Remove button in Application settings area of the box.
- Next step you have to do is to click on configuration button, with this Application Configuration box will appear as shown in the Figure-6.30. Click on the option tab.

Figure-6.30
- Make sure Enable Session is state is checked. The default Session timeout is 20 minutes. You can increase this timeout depending upon your needs.
- Click Ok.
Creating a Hit Counter
When your website starts to grow and you are doing good business on site. It’s likely you would like to know which page user go to first after the home page or you may be interested in knowing which page of your site is the most popular page. You can use the information to enhance your visitor browsing experience by keeping their taste in mind while updating your site.
Hit Counter is the powerful feature of Dreamweaver, which helps in tracking the total number of visitors to your site and also maintain the track of current number of users.
- Open the global.asa file and add the following code to the Session_onStart event.
Sub Session_onStart
Session(“StartTime”) = Now()
Application.Lock
Application(“TotalNumberOfUsers”) = _
Application(“TotalNumberOfUsers”) + 1
Application(“CurrentNumberOfUser”) = _
Application(“CurrentNumberOfUser”) + 1
Application.Unlock
End Sub
- Add the Following code to the Session_OnEnd event.
Sub Session_onEnd
Application.Lock
Application(“CurrentNumberOfUser”) = _
Application(“CurrentNumberOfUser”) - 1
Application.Unlock
End Sub
- Create a new File with the name of HitCounter.asp and add the following code.
<%= Application(“CurrentNumberOfUsers”) %> are current users
<br>
Total number of Visitors are<%=Application (“TotalNumberOfUsers”)%>
- Save and run the Page.