Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Opening a document from web

Opening a document from web

Scheduled Pinned Locked Moved C#
helpcsharpquestionasp-netdatabase
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dabs
    wrote on last edited by
    #1

    Hi all, this question might not fall into the C# category, and actually I'm not sure at all what category would fit better. But here it goes: I have a web application that displays a list of binary files which are stored in a database, and allows the user to view these files. Most of these files are images, and are viewed in a separate browser window. But some of them will be Office documents and perhaps other types (.pdf etc.). When the binary files are images, they will be displayed in this new browser window with no difficulty. If the file is of some other type, then sometimes the document can be opened as an embedded file, but sometimes it cannot (Firefox for instance doesn't seem to allow embedded documents, such as Office documents, and .msg files are never displayed inline in the browser). So if the file is, say, an .msg Outlook mail file, the browser will ask the user if it wants to save the file to disk or if the user wants to open the file. And here is my problem: under some circumstances (which I haven't been able to identify fully, but seems to happen all the time at my client site), when the user chooses to "Open" the file, he will receive an error from the application which is supposed to take care of opening the file. This error message says something along the lines of "Cannot open the file , the file may not exist, or you may not have the required permission etc. etc." (note this is not the actual error message, since the client isn't using English versions of Windows/Office). But if the users would choose to Save the file - and *then* to open it, then everything works according to plan. So are there any thought/ideas/suggestions? Somehow I cannot see where the problem lies, since my web application is simply delivering binary data (using Response.BinaryWrite in ASP.NET - C#), and this binary data *is* properly downloaded (otherwise the user wouldn't be able to save the file), but for some reason he gets this error message. Any help whatsoever would be highly appreciated! Best regards, Daniel

    P 1 Reply Last reply
    0
    • D dabs

      Hi all, this question might not fall into the C# category, and actually I'm not sure at all what category would fit better. But here it goes: I have a web application that displays a list of binary files which are stored in a database, and allows the user to view these files. Most of these files are images, and are viewed in a separate browser window. But some of them will be Office documents and perhaps other types (.pdf etc.). When the binary files are images, they will be displayed in this new browser window with no difficulty. If the file is of some other type, then sometimes the document can be opened as an embedded file, but sometimes it cannot (Firefox for instance doesn't seem to allow embedded documents, such as Office documents, and .msg files are never displayed inline in the browser). So if the file is, say, an .msg Outlook mail file, the browser will ask the user if it wants to save the file to disk or if the user wants to open the file. And here is my problem: under some circumstances (which I haven't been able to identify fully, but seems to happen all the time at my client site), when the user chooses to "Open" the file, he will receive an error from the application which is supposed to take care of opening the file. This error message says something along the lines of "Cannot open the file , the file may not exist, or you may not have the required permission etc. etc." (note this is not the actual error message, since the client isn't using English versions of Windows/Office). But if the users would choose to Save the file - and *then* to open it, then everything works according to plan. So are there any thought/ideas/suggestions? Somehow I cannot see where the problem lies, since my web application is simply delivering binary data (using Response.BinaryWrite in ASP.NET - C#), and this binary data *is* properly downloaded (otherwise the user wouldn't be able to save the file), but for some reason he gets this error message. Any help whatsoever would be highly appreciated! Best regards, Daniel

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      It still boils down to if the browser can support the file, though you are simply delivering binary data.

      "The clue train passed his station without stopping." - John Simmons / outlaw programmer

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups