Open file in iframe but file name format isn't standard

Ok I have a vbscript running that takes a session id and finds a folder on a server that has an htm file in it I want to show in an iframe. Works great except the people saving the files have not always saved under the same name format. The file could be "adr 200000.htm" or "adr # 200000.htm" or "adr#20000.htm" etc.... It always will start with "adr" and end with htm. I'm not sure who to handle that. From here on in I can set a standard, but I need to handle the old ones.
say my adr is 200001

Folder path is \\server\folder\200000-200999\200001\

file could be "adr 200001.htm" or "adr # 200001.htm" or "adr#200001.htm"

My code rigth now is
<%
path= "\\server\folder\"
adr = left(session("adr"),3)
path=path & adr & "000-" & adr & "999\" & session("adr") & "\adr " & session("adr") & ".htm"
%>
<iframe src="<% = path %>" width="789" height="1819" ></iframe>

I'm just not sure how to handle this...
LVL 2
t1clausenAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

John_LennonCommented:
if you know in what folder search, you can check all the files in that folder and see if it match your criteria, something like this

path= "\\server\folder\"
adr = left(session("adr"),3)
path=path & adr & "000-" & adr & "999\" & session("adr") & "\"

Set fso = CreateObject("Scripting.FileSystemObject")
Set ofolder=fso.getfolder(path)
Set oFiles=oFolder.files
for each f in oFiles
  if left(f.name, 3) = "adr" and right(f.name, 4) = ".htm" and instr(f.name, session("adr")) > 0 then
    'f.name is something like this: adr__session("adr")__.html (___ can be anything)
    strPage = f.name
    exit for
  else
    'f.name dosn't start with adr or dosn't finish with .htm or dosn't contain session("adr")
  end if
next
set oFiles = nothing
set oFolder = nothing
set FSO = nothing

%>
<iframe src="<% = path & strPage %>" width="789" height="1819" ></iframe>

'#################
see if that works

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
t1clausenAuthor Commented:
This looks good, but for some reason I just keep getting path not found errors. I hard coded a path in and still the same error? Any ideas?
t1clausenAuthor Commented:
The error happens on this line...

Set ofolder=fso.getfolder(path)
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

t1clausenAuthor Commented:
I took out everything except.

<%
path= "\\server\folder\"
adr = left(session("adr"),3)
path=path & adr & "000-" & adr & "999\" & session("adr") & "\"
%>

<iframe src="<% = path & strPage %>" width="789" height="1819" ></iframe>

and this opens the folder the files are in so I know the path is right.


 
John_LennonCommented:
i'm not sure, but maybe getFolder dosn't suport "virtual" paths like \\server\folder, let me search for it
t1clausenAuthor Commented:
The only thing I can find is something about a permissions error, but I can open the file and view the folder fine.
John_LennonCommented:
maybe IIS dosn't have permission, it's diferent the permission you get as a user in your computer, and the permission you need in IIS to acces folders and files, check you config in IIS and see if it say somethign about rights
t1clausenAuthor Commented:
It looks right to me. I think it's because I'm going to a remote server that happens to be a domain controller. I'll try some oever folders and see how that goes. Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.