Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 22nd, 2004, 04:09 PM
Authorized User
 
Join Date: Jun 2003
Location: Witham, Essex, United Kingdom.
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating a log file for multiple users

I want to create a log file tracking the sequence in which pages are accessed, using a text file. Can multiple users append to a single text file, or do I need to do separate ones for each user? If the former, what happens if more than one user tries to append at the same time?

Thanks
Pat

-------------------
System 3 2000 Limited
www.system3-2000.co.uk
__________________
-------------------
System 3 2000 Limited
www.system3-2000.co.uk (but very out-of-date!)
Reply With Quote
  #2 (permalink)  
Old June 22nd, 2004, 11:53 PM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

I think you can lock the file when logging the data, In this case if more than one user tries to append, then it will wait for one process to complete.

An alternative solution is to create table and store the activities in the database.

Om Prakash
Reply With Quote
  #3 (permalink)  
Old June 23rd, 2004, 12:53 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

I am also facing a similar problem. Thanks for the suggestion Om Prakash.

But,how can I lock a file ? Could you please explain it in some detail ?
Reply With Quote
  #4 (permalink)  
Old June 23rd, 2004, 06:04 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

You can use application object to lock:

For example:

<%
Application.Lock
  'do some application object operations
Application.Unlock
%>

Please check the following URL, which might be useful..

http://www.sloppycode.net/asp/?m=2



Om Prakash
Reply With Quote
  #5 (permalink)  
Old June 23rd, 2004, 06:18 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,960
Thanks: 79
Thanked 1,559 Times in 1,536 Posts
Default

Hi there,

Application.Lock does not lock the entire application; all it does is block other ASP pages from writing to the variables stored in the Application object. This is to prevent two users from writing to those variables at the same time.
Even if it would work, it would be a bad idea. It's not very good for performance and availability to lock an entire application for *all* users, just because you need to write to a file.

Personally, I would never try to store information like this in a text file. Text files in Web applications are not an ideal scalable solution.
Why don't you use a database? Databases are designed for multi-user environments.....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Micro cuts by Muse (Track 7 from the album: Origin of symmetry) What's This?
Reply With Quote
  #6 (permalink)  
Old June 23rd, 2004, 06:35 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Hello Imar,

Suppose we keep the log details in a database, will it be automatically multi-user friendly ? Or should we use stored procedures with transactions ?
Reply With Quote
  #7 (permalink)  
Old June 23rd, 2004, 06:40 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,960
Thanks: 79
Thanked 1,559 Times in 1,536 Posts
Default

That depends on the database and the number of users. Most databases are multi user, so you shouldn't have a problem. But some database are limited by the number of users they can serve. Technically, an Access database cannot handle more than 255 users at the same time, but in practice, this limit is hit much sooner.

There is no real need to use stored procedures and transactions, just to enable a multi-user scenario. However, when data integrity is important, you'll have to use transactions anyway (even if you were the only user). You'll also find that Stored Procedures will make database / application development much easier in the end.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Sunburn by Muse (Track 1 from the album: Showbiz) What's This?
Reply With Quote
  #8 (permalink)  
Old June 23rd, 2004, 07:08 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Hello Imar,

Thanks for this reply.
Reply With Quote
  #9 (permalink)  
Old June 24th, 2004, 02:06 AM
Authorized User
 
Join Date: Jun 2004
Location: , , India.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to silver_cuts Send a message via Yahoo to silver_cuts
Default

Hi imar,madhu

i am also planning to use a log file in my application .. about locking what i wanted to say that instead of locking the application if we lock the database file while we append the lock activities, wont it be a better idea ..

bocz acc. to my knowledge of database locks ... if the database is locked and another request comes that the new request is put in a queue until the first lock is opened ... so i think it will work fine ...more over i will never face the problem about the 255 users of ACCESS which i am using bcoz my application will be used atmost by 50 people all togather ....

so i need ur views on this ...

Sudhan.

Reply With Quote
  #10 (permalink)  
Old June 24th, 2004, 02:26 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Hi silver_cuts,

I agree with you totally. But I don't know how can I lock and unlock an access / sql server database. I have been searching for this for a long time.

I know how to lock a MySQL database. But I don't find similar features for MS Access and SQL server.
Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a list of users DennyLoi Javascript How-To 0 November 9th, 2007 04:32 AM
Creating Users through Front End feets SQL Server 2000 0 November 2nd, 2007 04:32 PM
Can't get Log to write the Log.txt file jnbutler BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 3 July 31st, 2007 05:04 AM
problem for creating the separate log file for con goel_man Apache Tomcat 0 December 19th, 2004 11:48 AM
Creating a log file from actions taken in a form lguzman Access VBA 2 November 3rd, 2004 10:58 AM



All times are GMT -4. The time now is 08:28 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.