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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Server.CreateObject() Failed" ASP help

Status
Not open for further replies.

stevepuri

Programmer
Mar 30, 2001
24
0
0
US
Hey,

I've got this VBScript function that
returns the path of a specified file
which I want to use in an ASP page but
get the following error:

Code:
Server object error 'ASP 0177 : 800a0035' 
Server.CreateObject Failed 
/myDir/myFile.asp, line 14 
00000000

Here is the code that gives
the above error:

Code:
<% @ LANGUAGE=&quot;VBSCRIPT&quot; %>
<HTML>

<HEAD>
	<TITLE>myFile.asp</TITLE>
</HEAD>

<BODY>

<%
Function GetFullPath(file)
	Dim FSO, f
	Set FSO = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
	Set f = FSO.GetFile(file) 'this is the error line 14
	GetFullPath = f.Path
End Function

Dim dbPATH
Set dbPATH = GetFullPath(&quot;myDatabase.mdb&quot;)
%>

Path of database on server is:<BR><%= dbPATH %>

</BODY>
</HTML>

I'm using Personal Web Server.
To run the ASP page, I type:
Which should display a page saying:
Path of database on server is:
C:\Inetpub\
Any ideas? Perhaps another way of doing it?

Thanks,
Steve.
 
don't use set in in the dbPath statement. the function returns a string - so
response.write getfullpath(&quot;db&quot;)
hope this helps
 
I just found the solution somewhere on the Web!
Thought I'd post it here to help others...

Code:
<% @ LANGUAGE=&quot;VBSCRIPT&quot; %>
<HTML>

<HEAD>
    <TITLE>myFile.asp</TITLE>
</HEAD>

<BODY>

<%
Dim dbPATH
dbPATH = Server.MapPath(&quot;myDatabase.mdb&quot;)
%>

Path of database on server is:<BR><%= dbPATH %>

</BODY>
</HTML>

Thats it! No need to write your own
function! Just use Server.MapPath()

PS...
Using &quot;Set&quot; does cause an error here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top