Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetFile or OpenTextFile = "File Not Found"??

Status
Not open for further replies.

mtorbin

Technical User
Nov 5, 2002
369
US
Hey all,

Here's a snippet of code I'm having trouble with:

Code:
Dim objFSO, objFile, objTextStream, objCaptureString, ipAddress

ipAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If ipAddress = "" Then
    ipAddress = Request.ServerVariables("REMOTE_ADDR")
End If

Set objFSO = CreateObject("Scripting.fileSystemObject")
Set objFile = objFSO.OpenTextFile("partNoSearchIPs.txt")
Set objTextStream = objFile.OpenAsTextStream(ForAppending, TristateFalse)

Set objCaptureString = ipAddress & "\n"

objTextStream.Close

I'm having trouble where it tries to open the file partNoSearchIPs.txt. It says that it can't find the file, but I know that it's there. What am I missing?

Thanks,

- MT
 
this server side of client side?


General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
I'm sure the file exists on the server because I put it there. Sorry guys and gals, you'll have to bare with me. I'm an apache/UINX guy, not a IIS/Windows guy. This is a server side script.

- MT
 
>[tt]Set objFile = objFSO.OpenTextFile("partNoSearchIPs.txt")[/tt]
[tt]Set objFile = objFSO.OpenTextFile([blue]server.mappath([/blue]"partNoSearchIPs.txt"[blue])[/blue])[/tt]
Or the path relative from there.

 
I made some adjustments and here is what I currently have:

Code:
<%@LANGUAGE="VBSCRIPT"%>
<%
Dim ipAddress, partNumber, filePath, ipLog, ipRecordSet

ipAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
partNumber = Request.QueryString("pn")

If ipAddress = "" Then
    IPAddress = Request.ServerVariables("REMOTE_ADDR")
End If

Set fso = Server.CreateObject("scripting.FileSystemObject")
filePath = server.mappath("partNoSearchIPs.txt")

Response.Write filePath

ipLog = fso.OpenTextFile(filePath)

ipRecordSet = "<tr><td>" & partNumber & "</td><td>" & ipAddress & "</td><td>" & Now & "</td></tr>"

ipLog.WriteLine(ipRecordSet)

ipLog.Close
%>

Unfortunately, I'm getting the following errors:

Code:
Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method

/pnsearch/tester.asp, line 17

Any help would be much appreciated.

- MT
 
>[tt]ipLog = fso_OpenTextFile(filePath)[/tt]
[tt][red]set[/red] ipLog = fso_OpenTextFile(filePath[blue],8,true[/blue]) '8=appending, true=create if not exist[/tt]

 
Why am I gettting

Code:
Microsoft VBScript runtime error '800a0046'

Permission denied

/pnsearch/tester.asp, line 18

I didn't think that there WERE any permissions in IIS.

- MT
 
The "internet guest account(IUSR_computername)" needs to have the proper permissions
 
I am about to complaint why the op post chaotic-like feedback without saying what they have done and what-not as followup, but, when I look at the op's profile, I say don't bother. Every effort is most probably not going to help. May be steven290 has more chance as a reaction from the op's part on this post.
 
I'm not quite sure what that is supposed to mean, but given the fact that I work full time, I don't have every opportunity to be as specific as I'd like. Frankly as far as I'm concerned, if you're going to be part of a community, then you should embrace the idea of helping one another, not trying to see who is the better man.

Steven, thanks for your help. I called my host and was able to get everything sorted out due to your suggestion. I really appreciate the help.

Tsuji, if you're going to post something, try to not make it so pointless.

- MT
 
>if you're going to be part of a community, then you should embrace the idea of helping one another, not trying to see who is the better man.

I suppose so. I'm not your employer after all.

But, I am trying to salvage a soul too, not from seeing your profile, but from your reasoning-in-action and your faculty of reasoning so reflected.

You're now long-time member of this site, have you embracing what you call, quote, the idea of helping one another, unquote? Have you ...etc...?

You ask other members, quote,to bare with me. I'm an apache/UINX guy, not a IIS/Windows guy, unquote. You ask other members to bare with you because, quote, I work full time, I don't have every opportunity to be as specific as I'd like. Saying it in passing is fine, but with your making as the reason for certain conduct, it is not a pretty picture to present to your interviewer/employer.

- tsuji
 
Conduct for what?? I had a question and I asked it. That' the point of this forum, and from what you're reading, it was answered.

- MT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top