Unable to open file remotely

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Seok Bee

    Unable to open file remotely

    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(txtAttachm ent.Text), 1, -1)
    Line 21: 'objStream.Open ("//Teklang1/ITRS_Testing/ITRS/Attachments/"
    & Trim(txtAttachm ent.Text))
    Line 22:

    Source File: D:\ITRS_Testing \ITRS\EnquiryRe sult.aspx Line: 20

    Stack Trace:

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

    Microsoft.Visua lBasic.Compiler Services.LateBi nding.InternalL ateCall(Object o,
    Type objType, String name, Object[] args, String[] paramnames, Boolean[]
    CopyBack, Boolean IgnoreReturn) +776
    Microsoft.Visua lBasic.Compiler Services.NewLat eBinding.LateCa ll(Object
    Instance, Type Type, String MemberName, Object[] Arguments, String[]
    ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean
    IgnoreReturn) +365640
    ASP.itrs_enquir yresult_aspx.Vi ewDoc(Object Source, EventArgs E) in
    D:\ITRS_Testing \ITRS\EnquiryRe sult.aspx:20
    System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +105
    System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String eventArgument)
    +107

    System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument) +7
    System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
    sourceControl, String eventArgument) +11
    System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
    System.Web.UI.P age.ProcessRequ estMain(Boolean
    includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5102



    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.507 27.42; ASP.NET
    Version:2.0.507 27.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.

  • vbnetdev

    #2
    Re: Unable to open file remotely

    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
    "Configurat ion" 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




    "Seok Bee" <seokbee@yahoo. com> wrote in message
    news:DC12601C-E1B7-4248-A229-1C9795321617@mi crosoft.com...[color=blue]
    > 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(txtAttachm ent.Text), 1, -1)
    > Line 21:
    > 'objStream.Open ("//Teklang1/ITRS_Testing/ITRS/Attachments/"
    > & Trim(txtAttachm ent.Text))
    > Line 22:
    >
    > Source File: D:\ITRS_Testing \ITRS\EnquiryRe sult.aspx Line: 20
    >
    > Stack Trace:
    >
    > [COMException (0xc004800a): Exception from HRESULT: 0xC004800A]
    >
    > Microsoft.Visua lBasic.Compiler Services.LateBi nding.InternalL ateCall(Object
    > o,
    > Type objType, String name, Object[] args, String[] paramnames, Boolean[]
    > CopyBack, Boolean IgnoreReturn) +776
    > Microsoft.Visua lBasic.Compiler Services.NewLat eBinding.LateCa ll(Object
    > Instance, Type Type, String MemberName, Object[] Arguments, String[]
    > ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean
    > IgnoreReturn) +365640
    > ASP.itrs_enquir yresult_aspx.Vi ewDoc(Object Source, EventArgs E) in
    > D:\ITRS_Testing \ITRS\EnquiryRe sult.aspx:20
    > System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +105
    > System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String
    > eventArgument)
    > +107
    >
    > System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
    > eventArgument) +7
    > System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
    > sourceControl, String eventArgument) +11
    > System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
    > System.Web.UI.P age.ProcessRequ estMain(Boolean
    > includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5102
    >
    >
    >
    > --------------------------------------------------------------------------------
    > Version Information: Microsoft .NET Framework Version:2.0.507 27.42;
    > ASP.NET
    > Version:2.0.507 27.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.
    >[/color]


    Comment

    • vbnetdev

      #3
      Re: Unable to open file remotely

      These are not vb.net solutions. But they do work.

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

      Dim oStream
      set oStream = server.CreateOb ject("ADODB.Str eam")
      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.Positio n = 0
      Response.Conten tType = "text/html"
      Response.Write oStream.ReadTex t
      oStream.close

      %>

      oR


      <%
      Set xml = Server.CreateOb ject("MSXML2.Se rverXMLHTTP")
      url="http://www.myserver.co m/textFile.txt"
      xml.Open "GET", url, true ' the True specifies an asynchronous request
      Call xml.Send()
      Response.write xml.Responsetex t

      %>




      oR

      HTML>
      <HEAD>
      <script language=VBScri pt >

      Dim objStream
      Set objStream = CreateObject("A DODB.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.SaveT oFile "C:\TEMP\notepa d.exe", 2 ' adSaveCreateOve rWrite
      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\notep ad.exe")
      Set WsShell = Nothing

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


      --
      Get a powerful web, database, application, and email hosting with KJM
      Solutions




      "Seok Bee" <seokbee@yahoo. com> wrote in message
      news:DC12601C-E1B7-4248-A229-1C9795321617@mi crosoft.com...[color=blue]
      > 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(txtAttachm ent.Text), 1, -1)
      > Line 21:
      > 'objStream.Open ("//Teklang1/ITRS_Testing/ITRS/Attachments/"
      > & Trim(txtAttachm ent.Text))
      > Line 22:
      >
      > Source File: D:\ITRS_Testing \ITRS\EnquiryRe sult.aspx Line: 20
      >
      > Stack Trace:
      >
      > [COMException (0xc004800a): Exception from HRESULT: 0xC004800A]
      >
      > Microsoft.Visua lBasic.Compiler Services.LateBi nding.InternalL ateCall(Object
      > o,
      > Type objType, String name, Object[] args, String[] paramnames, Boolean[]
      > CopyBack, Boolean IgnoreReturn) +776
      > Microsoft.Visua lBasic.Compiler Services.NewLat eBinding.LateCa ll(Object
      > Instance, Type Type, String MemberName, Object[] Arguments, String[]
      > ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean
      > IgnoreReturn) +365640
      > ASP.itrs_enquir yresult_aspx.Vi ewDoc(Object Source, EventArgs E) in
      > D:\ITRS_Testing \ITRS\EnquiryRe sult.aspx:20
      > System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +105
      > System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String
      > eventArgument)
      > +107
      >
      > System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
      > eventArgument) +7
      > System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
      > sourceControl, String eventArgument) +11
      > System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
      > System.Web.UI.P age.ProcessRequ estMain(Boolean
      > includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5102
      >
      >
      >
      > --------------------------------------------------------------------------------
      > Version Information: Microsoft .NET Framework Version:2.0.507 27.42;
      > ASP.NET
      > Version:2.0.507 27.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.
      >[/color]


      Comment

      Working...