NetTalk Central

Author Topic: Alternate method to serve up a page blocking access to browses  (Read 17637 times)

pcrafton

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Alternate method to serve up a page blocking access to browses
« on: October 12, 2007, 01:07:32 PM »
1. create a netwebpage (ex.: indexerror)

2. on netwebpage properties name the page and then go to properties,  create a body entry and add your HTML for example:

<html>
<head>
<title>NOT AUTHORIZED</title>
<meta http-equiv="Content-Type" content="text/html"; charset="ISO-8859-1" />
<link href="styles/error.css" rel="stylesheet" type="text/css" />
</head>
<body class="ErrorPage">
<hr />
<center>
<img src="./images/noentry.jpg" alt="Not Allowed" /><br /><br />
<P style="font-size: 18pt;font-weight: bold;color: red">YOU ARE NOT AUTHORIZED TO VIEW THIS DATA</p>
</center>
<hr />
</body>
</html>

3. I use a global queue in the webserver, using a NetTalk NetSimple Object, I keep track in the Netsimple Process Method of IP Address, Socket, SockID and User Name in my global queue upon new connection to the web server. I use this queue to determine if the user requesting a web page is a valid user of the system. I pass an unseen login upon connection from client to the webserver and store the userid asoociated with the IP Address of their laptop/PC.

4. In the webserver when a request comes in for a web browse, in the StartNewThread procedure, I do the following, where connq is the queue. If there is no connq:connuserid, the user has not logged on the our system, and is suspect. :

5. I set the default page to the errorpage created above and serve it up instead of the normal index page. I reset the _SitesQueue if they are logged in as to not muck up the works afterwards, or for any subsequent users.

    connq:connip = p_RequestData.FromIP
    get(connq,connq:connip)
    if errorcode() or ~connq:connuserid then
       Get(ThisWebServer._SitesQueue,1)
       ThisWebServer._SitesQueue.Defaults.DefaultPage = 'indexerror.htm'
       put(ThisWebServer._SitesQueue)
     ELSE
       Get(ThisWebServer._SitesQueue,1)
       ThisWebServer._SitesQueue.Defaults.DefaultPage = 'index3.htm'
       put(ThisWebServer._SitesQueue)
     end

I know there are other methods but this works for our purposes.

regards

Paul Crafton