| <%@language="JScript"%>
<%
function ReadException(expException)
{
var strResult = "Exception Detail: " + " "; strResult += "Number: " + expException.number + " "; strResult += "Description: " + expException.description + " "; strResult += "Name: " + expException.name + " "; strResult += "Message: " + expException.message + " "; return (strResult); } var strCounterName = "asp_count.txt"; var strCounterPath = Server.MapPath(strCounterName); var fsoCounter = Server.CreateObject("Scripting.FileSystemObject"); var stmInputStream = null; var stmOutputStream = null; var FOR_READING = 1; var FOR_WRITING = 2; var FOR_APPENDING = 3; var iCounter = 1; //First, check to see if the counter file already exists if(!fsoCounter.FileExists(strCounterPath)) { //It doesn't, so let's create it and put a 1 in there try { stmOutputStream = fsoCounter.CreateTextFile(strCounterPath, true); stmOutputStream.WriteLine(iCounter); stmOutputStream.Close(); } catch(expFileError) { Response.Write("An error occured while trying to create the following file:" + strCounterPath + " " + ReadException(expFileError)); Response.End(); } } else { //It exists, so let's read the value, increment it and write it back try { //Read the current counter value and increment it stmInputStream = fsoCounter.OpenTextFile(strCounterPath, FOR_READING, false); iCounter = parseInt(stmInputStream.ReadLine()); iCounter++; stmInputStream.Close(); //Write it back to the file stmOutputStream = fsoCounter.OpenTextFile(strCounterPath, FOR_WRITING, false); stmOutputStream.WriteLine(iCounter); stmOutputStream.Close(); } catch(expFileError) { Response.Write("An error occured while trying to read or update the following file:" + strCounterPath + " " + ReadException(expFileError)); Response.End(); } } //Cleanup fsoCounter = null; stmInputStream = null; stmOutputStream = null; //Return the current counter value Response.Write(iCounter); %> |
|||
| . |
|
||
|
|
|||
| . | IRHA Fall 2004 -OH WOW, NOT UPDATED IN MUCHO LONG
TIME -Agendas and Minutes are NOW POSTED ONLINE!!!!! |
||