Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   ASP Clásico (http://www.forosdelweb.com/f15/)
-   -   contador en el gobal.asa (http://www.forosdelweb.com/f15/contador-gobal-asa-601584/)

portillo18 01/07/2008 02:59

contador en el gobal.asa
 
Buenos dias a todos!

Estoy realizando un contador de visitas en mi pagina web, en el global.asa guardo en una variable de session el nº de visitante y a su vez lo guardo tambien en un fichero de texto por si se reinicia el servidor, pues bien el error que me da es el siguiente:

Cita:

Error de Microsoft VBScript en tiempo de ejecución error '800a0046'

Permiso denegado

/LM/W3SVC/247121831/Root/global.asa, línea 52

La linea 52 esta dentro del Session_OnStart, que tiene lo siguiente:


Cita:

Sub Session_OnStart

'Abre la conexion con la base de datos
'Reservas.Open (Application("ConexionStringCasas"))
Reservas.Open ("Provider=SQLOLEDB; Data Source=192.168.1.101; Initial Catalog=db_Reservas; User Id=sa; Password=LE6260ZBNW;")

'abro bbdd db_reservasinvitado
ReservasInvitado.Open ("Provider=SQLOLEDB; Data Source=192.168.1.101; Initial Catalog=db_ReservasInvitado; User Id=sa; Password=LE6260ZBNW;")

' Create a server object
set fso = createobject("scripting.filesystemobject")

' Target the text file to be opened
set act = fso.opentextfile(server.mappath("Contador.txt"))



' Read the value of the text document
' If the text document does not exist then the on error resume next
' will drop down to the next line
counter = clng(act.readline)

' Add one to the counter
counter = counter + 1

' Close the object
act.close

' Create a new text file on the server, esta es la linea 52 \/ donde me da el error
Set act = fso.CreateTextFile(server.mappath("Contador.txt"), true)

' Write the current counter value to the text document
act.WriteLine(Application("contador"))

Application("contador")=counter
' Close the object
act.Close



Session("Start") = Now()
Session.TimeOut = 100


End Sub


No se porque será!!


espero que puedan ayudarme, es urgente gracias!

Adler 01/07/2008 04:22

Respuesta: contador en el gobal.asa
 
Hola

¿Sabes si tu servidor te permite usa fso?. Consultalo

Suerte

portillo18 01/07/2008 04:35

Respuesta: contador en el gobal.asa
 
Gracias Adler!

si el objeto fso esta instalado en el servidor.¿Puede ser algún problema de permisos?
esque si copio el codigo en el Application_OnStart he comprobado que no me da ningun error pero no me vale porque lo correcto seria que estubiera en Session_OnStart



Gracias

Shiryu_Libra 01/07/2008 13:26

Respuesta: contador en el gobal.asa
 
portillo, cual es tu linea 52? la del FSO, donde intenta realizar la lectura del archivo?

si esta permitido el uso de FSO en tu servidor, pero no tienes permisos de escritura, es por el cual te da error de "permiso denegado"

el permiso de escritura en lugar de realizarlo en la misma carpeta del ROOT, deberias de hacerlo en una carpeta exclusiva para este proposito

por ejemplo
Cita:

tusitio/ <-- ROOT
tusitio/contador/ <--- carpeta exlusiva para tu contador, el cual debera tener permiso de escritura para el usuario IUSR

el server.mappath, deberas cambiarlo a lo siguiente
Cita:

server.mappath("./contador/Contador.txt")
:adios:

portillo18 02/07/2008 04:22

Respuesta: contador en el gobal.asa
 
Muchas Gracias!!Era problema de permisos!


Ahora me ha surgido otro problema:

En la página principal a la hora de mostrar el nº de visitas, lo hago pero en numeros romanos, me funcioa en internet explorer pero no en mozilla firefox, les muestro el código:

Cita:

<td width="60%" align="center">
<input type="hidden" value=<%=Application("contador")%> name=numeral size="10" onKeypress="if (event.keyCode<48 || event.keyCode>57) event.returnValue=false;" onblur="this.setAttribute('value', this.value);" maxlength="10">
<img src="udjat.jpg" width="18" height="18">&nbsp;<font color="#CC0033" face="Geneva, Arial, Helvetica, sans-serif, Rockwell"><script language="JavaScript">romanise()</script></font>&nbsp;<img src="udjat_2.jpg" width="18" height="18"></td>
En este lo muestro



La funcion para romanizar es la siguiente:

Cita:

function romanise(){

var persian=numeral.value;
var roman="";
var ronumdashes="";
var buffer=10-persian.length;

while (buffer>0) {persian="0"+persian;buffer--}

var units=new Array("","I","II","III","IV","V","VI","VII","VIII" ,"IX");
var tens=new Array("","X","XX","XXX","XL","L","LX","LXX","LXXX" ,"XC");
var hundreds=new Array("","C","CC","CCC","CD","D","DC","DCC","DCCC" ,"CM");
var thousands=new Array("","M","MM","MMM","MV","V","VM","VMM","VMMM" ,"MX");
var billionsdashes=new Array("","=","==","===","==","=","==","===","====" ,"==");

romandashes=billionsdashes[persian.substring(0,1)];

var hundredmillionsdashes=new Array("","=","==","===","==","=","==","===","====" ,"==");

romandashes+=hundredmillionsdashes[persian.substring(1,2)];

var tenmillionsdashes=new Array("","=","==","===","==","=","==","===","====" ,"==");

romandashes+=tenmillionsdashes[persian.substring(2,3)];

var millionsdashes=new Array("","_","__","___","_=","=","=_","=__","=___" ,"_=");

romandashes+=millionsdashes[persian.substring(3,4)];

var hundredthousandsdashes=new Array("","_","__","___","__","_","__","___","____" ,"__");

romandashes+=hundredthousandsdashes[persian.substring(4,5)];

var tenthousandsdashes=new Array("","_","__","___","__","_","__","___","____" ,"__");

romandashes+=tenthousandsdashes[persian.substring(5,6)];

var thousandsdashes=new Array("","","",""," _","_","_","_","_"," _");

romandashes+=thousandsdashes[persian.substring(6,7)];

roman=thousands[persian.substring(0,1)];

roman+=hundreds[persian.substring(1,2)];

roman+=tens[persian.substring(2,3)];

roman+=thousands[persian.substring(3,4)];

roman+=hundreds[persian.substring(4,5)];

roman+=tens[persian.substring(5,6)];

roman+=thousands[persian.substring(6,7)];

roman+=hundreds[persian.substring(7,8)];

roman+=tens[persian.substring(8,9)];

roman+=units[persian.substring(9,10)];
//este br iria romandashes+"<br>"+roman;


var result = romandashes+roman;

document.write(result);


}
</script>


El problema como mencioné esque en internet explorer me lo muestra correctamente pero en firefox no


Gracias de antemano


La zona horaria es GMT -6. Ahora son las 06:23.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.