Jump to content

ecluley

Members
  • Posts

    25
  • Joined

  • Last visited

Posts posted by ecluley

  1. ok, i have tried the openTextFile method and am now running it though firefox. i have uploaded it to a free asp server and am running it from there as I have changed computers (on holiday) and no am without ISS (dam xp home!) The error message i recieve isServer object error 'ASP 0177 : 800401f3'Server.CreateObject Failed/umbrellamembers/upload_news.asp, line 11800401f3 i now recieve this for the ftp.asp page aswell when i try to read the text file.both pages, ftp.asp and upload_news.asp seam to have a problem with Server.CreateObject. This line normally works fine when i run it though IIS on my computer but now i have uploaded it it causes problems.Sory about all this but i just dont understand why i wont work and will on my pc at home but not when uploaded to the webspace. Thanks for all your help thus far,Ewen

  2. Okay, the text file DOES already exist so i assume this is the problem. How can I make ASP overwrite the existing text file? I want to be able to let the user make changes to the existing text file. how do i do this? thanks.

  3. "An error occurred on the server when processing the URL. Please contact the system administrator"it stops happening when i remark out the offending line of code but i kinda need that line of code...when i have "show friendly http error messages" ticked in internet options it gives me a HTTP 500 Internal Server Errorthanks for the responseEwen

  4. I am learning ASP whilst building a website to allow users to login and edit text files which are part of ofther websites i make for them. I have 3 pages: index.asp which is a simple login form with code for checking if username and password is correct. This creates a session object which stores the username and a string "YES" if the password is valid and "NO" if not. This all works perfectly. The second page is a page to edit the text file. It reads the seession object and then displays the text contained in the text file. It will also display a form for enterning new text into the file. Every user will have a different folder on the server named identically to their username. So for example, username "umb01" will have a folder called "umb01" containg a file called news.txt. This page also works fine, except when u click on the submit button on the form. It takes you to the page upload_news.asp which is where the problems come in. This page should simply write the data to the file but it return an error.Heres the codeindex.asp:

    <html><head><%sub refresh()	dim fname, password, usrdata(2), pswrddata(2), i, j	fname=Request.form("fname")	password=Request.form("pswrd")	If fname<>"" Then		usrdata(0)="umb01"		usrdata(1)="umb02"		usrdata(2)="umb03"		pswrddata(0) ="cheese"		pswrddata(1) ="beef"		pswrddata(2) = "pedo"		j=200		for i = 0 to 2			If usrdata(i) = fname Then				j = i				response.write("Usr names match, checking passwords <br/>")			End If		next		If j<=199 Then			If password=pswrddata(j) Then				response.write("passwords match <br/> Access Granted")				Session("permission")="YES" 				Session("username")=fname 				Response.Redirect("ftp.asp")				Response.End()			Else				response.write("Access Denied")				Session("permission")="NO" 				Session("username")=fname 				Response.Redirect("ftp.asp")				Response.End()			End If		End If	End Ifend sub%><body><form action="index.asp" method="post">Your name: <input type="text" name="fname" size="20" />Your pswrd: <input type="password" name="pswrd" size="20" /><input type="submit" value="Submit" /></form><%call refresh()%></body></html>

    ftp.asp:

    <html> <title>Our private pages</title> <body><%If Session("permission") = "YES" Then	Response.write("Access Granted")%>			Current Text:<br>			<%				Dim fs,f, usr, newsTxt, ts, fo				usr = Session("username")				newsTxt = request.form("news")				Set fs=Server.CreateObject("Scripting.FileSystemObject")				Set f=fs.OpenTextFile(Server.MapPath(usr & "\news.txt"), 1)				Response.write(f.ReadAll)				set f=nothing				set fs=nothing			%>			<FORM ACTION="upload_news.asp" METHOD=post> 			News: <input type="textarea" name="news" size="20" />			<INPUT TYPE=submit value="Submit"> 			</FORM>)<% Else	Response.write("Access Denied")End If%></body> </html>

    upload_news.asp:

    <html> <title>Edit News Page</title> <body><%Dim fs,f, usr, newsTxtusr = Session("username")newsTxt = request.form("news")Set fs=Server.CreateObject("Scripting.FileSystemObject")Set f = fs.CreateTextFile(Server.MapPath(usr & "\news.txt"))f.write(newsTxt)set f=nothingset fs=nothing%></body> </html>

    The problem line seams to be this one:Set f = fs.CreateTextFile(Server.MapPath(usr & "\news.txt"))but i don't know what ive done wrong.If anyone has any suggestions / comments / ideas, please help! I am running windows vista, so thats... IIS 7.0 i think.Thank you all.Ewen

×
×
  • Create New...