Home All Groups Group Topic Archive Search About

Unable to open file remotely

Author
21 Feb 2006 9:36 AM
Seok Bee
Dear Experts,

In my web application, I am having a button to open a file located in the
server. When I click on the button to view the file, I received the following
error message:
----------------------------------------------------------
Exception from HRESULT: 0xC004800A
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Exception
from HRESULT: 0xC004800A

Source Error:

Line 18:         objStream.Type = 1 ' adTypeBinary
Line 19:         ' The following should be the absolute URL to the file on
the server.....
Line 20:        
objStream.Open("URL=http://Teklang1/ITRS_Testing/ITRS/Attachments/" &
Trim(txtAttachment.Text), 1, -1)
Line 21:         'objStream.Open("//Teklang1/ITRS_Testing/ITRS/Attachments/"
& Trim(txtAttachment.Text))
Line 22:         

Source File: D:\ITRS_Testing\ITRS\EnquiryResult.aspx    Line: 20

Stack Trace:

[COMException (0xc004800a): Exception from HRESULT: 0xC004800A]

Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack, Boolean IgnoreReturn) +776
   Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean
IgnoreReturn) +365640
   ASP.itrs_enquiryresult_aspx.ViewDoc(Object Source, EventArgs E) in
D:\ITRS_Testing\ITRS\EnquiryResult.aspx:20
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
+107
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET
Version:2.0.50727.42
-----------------------------------------------------------------

The webserver is running on Windows 2000 sp4 and with .NET Framework 1.1,
1.1 sp1 and 2.0 being installed. This server is also running as Active
Directory. I have manually created a user named ASPNET and assigned full
control to the folder that contains my files.

May I know what is the possible solution to this problem? Please advise.
Thanks.

Author
21 Feb 2006 8:25 PM
vbnetdev
One possibility is absolute paths are disabled in IIS.

Ask your web provider to go into IIS and enable this for you. Or code around
it. Go to IIS properties for the site and go to Home Directory. Click
"Configuration" and then "Options" and check "Absoulte paths" allowed.

Or better yet host with me and not have this issue.

(Just kidding.) :)
--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Show quoteHide quote
"Seok Bee" <seok***@yahoo.com> wrote in message
news:DC12601C-E1B7-4248-A229-1C9795321617@microsoft.com...
> Dear Experts,
>
> In my web application, I am having a button to open a file located in the
> server. When I click on the button to view the file, I received the
> following
> error message:
> ----------------------------------------------------------
> Exception from HRESULT: 0xC004800A
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about
> the error and where it originated in the code.
>
> Exception Details: System.Runtime.InteropServices.COMException: Exception
> from HRESULT: 0xC004800A
>
> Source Error:
>
> Line 18:         objStream.Type = 1 ' adTypeBinary
> Line 19:         ' The following should be the absolute URL to the file on
> the server.....
> Line 20:
> objStream.Open("URL=http://Teklang1/ITRS_Testing/ITRS/Attachments/" &
> Trim(txtAttachment.Text), 1, -1)
> Line 21:
> 'objStream.Open("//Teklang1/ITRS_Testing/ITRS/Attachments/"
> & Trim(txtAttachment.Text))
> Line 22:
>
> Source File: D:\ITRS_Testing\ITRS\EnquiryResult.aspx    Line: 20
>
> Stack Trace:
>
> [COMException (0xc004800a): Exception from HRESULT: 0xC004800A]
>
> Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object
> o,
> Type objType, String name, Object[] args, String[] paramnames, Boolean[]
> CopyBack, Boolean IgnoreReturn) +776
>   Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object
> Instance, Type Type, String MemberName, Object[] Arguments, String[]
> ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean
> IgnoreReturn) +365640
>   ASP.itrs_enquiryresult_aspx.ViewDoc(Object Source, EventArgs E) in
> D:\ITRS_Testing\ITRS\EnquiryResult.aspx:20
>   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
>   System.Web.UI.WebControls.Button.RaisePostBackEvent(String
> eventArgument)
> +107
>
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
> eventArgument) +7
>   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
> sourceControl, String eventArgument) +11
>   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
>   System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
>
>
>
> --------------------------------------------------------------------------------
> Version Information: Microsoft .NET Framework Version:2.0.50727.42;
> ASP.NET
> Version:2.0.50727.42
> -----------------------------------------------------------------
>
> The webserver is running on Windows 2000 sp4 and with .NET Framework 1.1,
> 1.1 sp1 and 2.0 being installed. This server is also running as Active
> Directory. I have manually created a user named ASPNET and assigned full
> control to the folder that contains my files.
>
> May I know what is the possible solution to this problem? Please advise.
> Thanks.
>
Author
21 Feb 2006 10:18 PM
vbnetdev
These are not vb.net solutions. But they do work.

<%
Response.Buffer = True
Const adTypeBinary = 1
Const adReadAll = -1

Dim oStream
set oStream = server.CreateObject("ADODB.Stream")
oStream.Type = 2
oStream.Charset = "ascii"
oStream.Open "URL=http://testserver/test/hello.htm", 1, -1

'Response.write oStream.State
'Response.End
'oStream.Read

'Response.Write oStream.Size
'Response.End

oStream.Position = 0
Response.ContentType = "text/html"
Response.Write oStream.ReadText
oStream.close

%>

oR


<%
Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
url="http://www.myserver.com/textFile.txt"
xml.Open "GET", url, true   ' the True specifies an asynchronous request
Call xml.Send()
Response.write xml.Responsetext

%>




oR

HTML>
<HEAD>
<script language=VBScript >

Dim objStream
Set objStream = CreateObject("ADODB.Stream")
objStream.Type = 1 ' adTypeBinary
' The following should be the absolute URL to the file on the server.....
objStream.Open ("URL=http://localhost/notepad.exe")
document.write "<CENTER>Loaded...<BR>"
' This should be the full path and filename to save the file on the
client....
objStream.SaveToFile "C:\TEMP\notepad.exe", 2 ' adSaveCreateOverWrite
document.write "saved..<BR>"
objStream.Close
Set objStream = Nothing
' Now we'll "run" the file....
Dim WshShell
Set WshShell =CreateObject("WScript.Shell")
WshShell.Run ("c:\temp\notepad.exe")
Set WsShell = Nothing

</script>
<TITLE>Download and Install Page</TITLE>
</HEAD>
<BODY>
DONE!</CENTER>
</BODY>
</HTML>


--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Show quoteHide quote
"Seok Bee" <seok***@yahoo.com> wrote in message
news:DC12601C-E1B7-4248-A229-1C9795321617@microsoft.com...
> Dear Experts,
>
> In my web application, I am having a button to open a file located in the
> server. When I click on the button to view the file, I received the
> following
> error message:
> ----------------------------------------------------------
> Exception from HRESULT: 0xC004800A
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about
> the error and where it originated in the code.
>
> Exception Details: System.Runtime.InteropServices.COMException: Exception
> from HRESULT: 0xC004800A
>
> Source Error:
>
> Line 18:         objStream.Type = 1 ' adTypeBinary
> Line 19:         ' The following should be the absolute URL to the file on
> the server.....
> Line 20:
> objStream.Open("URL=http://Teklang1/ITRS_Testing/ITRS/Attachments/" &
> Trim(txtAttachment.Text), 1, -1)
> Line 21:
> 'objStream.Open("//Teklang1/ITRS_Testing/ITRS/Attachments/"
> & Trim(txtAttachment.Text))
> Line 22:
>
> Source File: D:\ITRS_Testing\ITRS\EnquiryResult.aspx    Line: 20
>
> Stack Trace:
>
> [COMException (0xc004800a): Exception from HRESULT: 0xC004800A]
>
> Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object
> o,
> Type objType, String name, Object[] args, String[] paramnames, Boolean[]
> CopyBack, Boolean IgnoreReturn) +776
>   Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object
> Instance, Type Type, String MemberName, Object[] Arguments, String[]
> ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean
> IgnoreReturn) +365640
>   ASP.itrs_enquiryresult_aspx.ViewDoc(Object Source, EventArgs E) in
> D:\ITRS_Testing\ITRS\EnquiryResult.aspx:20
>   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
>   System.Web.UI.WebControls.Button.RaisePostBackEvent(String
> eventArgument)
> +107
>
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
> eventArgument) +7
>   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
> sourceControl, String eventArgument) +11
>   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
>   System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
>
>
>
> --------------------------------------------------------------------------------
> Version Information: Microsoft .NET Framework Version:2.0.50727.42;
> ASP.NET
> Version:2.0.50727.42
> -----------------------------------------------------------------
>
> The webserver is running on Windows 2000 sp4 and with .NET Framework 1.1,
> 1.1 sp1 and 2.0 being installed. This server is also running as Active
> Directory. I have manually created a user named ASPNET and assigned full
> control to the folder that contains my files.
>
> May I know what is the possible solution to this problem? Please advise.
> Thanks.
>