locked
PDF documents opening problem RRS feed

  • Question

  • I have a document library in which documents are uploaded and given a customized page(Hyperlinks for each document) for users to download those documents. I redirects through links to download.aspx page under layouts folder. /_layouts/download.aspx now the problem that i encounters is that, I have 2 users, 1 is site administrator and other is a normal site user with limited site permissions.(but both have full control to document library.) Both uses same link to dowload the file. Both downloads the pdf file but one downloaded by normal user does not open in adobe reader with error : "there was an error opening this document. the file is damaged and could not be repaired". Now i compared two files downloaded, 1 by user and other by admin and found the one downloaded by user is 3 kb more in size always and compared both files with ARAXIS MERGE shows some html appended to 1 downloaded by normal user :

    <html>
    <head>
       
    <title>Runtime Error</title>
       
    <style>
         body
    {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
         p
    {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b
    {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1
    { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2
    { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre
    {font-family:"Lucida Console";font-size: .9em}
         
    .marker {font-weight: bold; color: black;text-decoration: none;}
         
    .version {color: gray;}
         
    .error {margin-bottom: 10px;}
         
    .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
       
    </style>
    </head>

    <body bgcolor="white">

           
    <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

           
    <h2> <i>Runtime Error</i> </h2></span>

           
    <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

           
    <b> Description: </b>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
           
    <br><br>

           
    <b>Details:</b> To enable the details of this specific error message to be viewable on remote machines, please create a &lt;customErrors&gt; tag within a &quot;web.config&quot; configuration file located in the root directory of the current web application. This &lt;customErrors&gt; tag should then have its &quot;mode&quot; attribute set to &quot;Off&quot;.<br><br>

           
    <table width=100% bgcolor="#ffffcc">
               
    <tr>
                 
    <td>
                     
    <code><pre>

    <!-- Web.Config Configuration File -->

    <configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration>

                  </td>
               
    </tr>
           
    </table>

           
    <br>

           
    <b>Notes:</b> The current error page you are seeing can be replaced by a custom error page by modifying the &quot;defaultRedirect&quot; attribute of the application's &lt;customErrors&gt; configuration tag to point to a custom error page URL.<br><br>

           
    <table width=100% bgcolor="#ffffcc">
               
    <tr>
                 
    <td>
                     
    <code><pre>

    <!-- Web.Config Configuration File -->

    <configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration>

                  </td>
               
    </tr>
           
    </table>

           
    <br>

    </body>

     

    when i remove this part by opening this file in notepad, the document becomes correct for adobe reader to be opened and it opens it.

    I also found one particular error in event viewer for this :

    Event code: 4011. Event message: An unhandled access exception has occurred.

    Friday, September 30, 2011 8:42 AM

Answers

  • HI,

    The event code should be 401 and not 4011 can you confirm this? Also as suggested in the message above modify web.config of your web application to capture your details.

    carry out these changes:

    EnableStackTrace=True

    CustomError=Off

    I hope this will help you out.


    Thanks, Rahul Rashu
    Monday, October 3, 2011 2:48 AM

All replies

  • I have a document library in which documents are uploaded and given a customized page(Hyperlinks for each document) for users to download those documents. I redirects through links to download.aspx page under layouts folder. /_layouts/download.aspx now the problem that i encounters is that, I have 2 users, 1 is site administrator and other is a normal site user with limited site permissions.(but both have full control to document library.) Both uses same link to dowload the file. Both downloads the pdf file but one downloaded by normal user does not open in adobe reader with error : "there was an error opening this document. the file is damaged and could not be repaired". Now i compared two files downloaded, 1 by user and other by admin and found the one downloaded by user is 3 kb more in size always and compared both files with ARAXIS MERGE shows some html appended to 1 downloaded by normal user :

    <html>
    <head>
       
    <title>Runtime Error</title>
       
    <style>
         body
    {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
         p
    {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b
    {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1
    { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2
    { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre
    {font-family:"Lucida Console";font-size: .9em}
         
    .marker {font-weight: bold; color: black;text-decoration: none;}
         
    .version {color: gray;}
         
    .error {margin-bottom: 10px;}
         
    .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
       
    </style>
    </head>

    <body bgcolor="white">

           
    <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

           
    <h2> <i>Runtime Error</i> </h2></span>

           
    <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

           
    <b> Description: </b>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
           
    <br><br>

           
    <b>Details:</b> To enable the details of this specific error message to be viewable on remote machines, please create a &lt;customErrors&gt; tag within a &quot;web.config&quot; configuration file located in the root directory of the current web application. This &lt;customErrors&gt; tag should then have its &quot;mode&quot; attribute set to &quot;Off&quot;.<br><br>

           
    <table width=100% bgcolor="#ffffcc">
               
    <tr>
                 
    <td>
                     
    <code><pre>

    <!-- Web.Config Configuration File -->

    <configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration>

                  </td>
               
    </tr>
           
    </table>

           
    <br>

           
    <b>Notes:</b> The current error page you are seeing can be replaced by a custom error page by modifying the &quot;defaultRedirect&quot; attribute of the application's &lt;customErrors&gt; configuration tag to point to a custom error page URL.<br><br>

           
    <table width=100% bgcolor="#ffffcc">
               
    <tr>
                 
    <td>
                     
    <code><pre>

    <!-- Web.Config Configuration File -->

    <configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration>

                  </td>
               
    </tr>
           
    </table>

           
    <br>

    </body>

     

    when i remove this part by opening this file in notepad, the document becomes correct for adobe reader to be opened and it opens it.

    I also found one particular error in event viewer for this :

    Event code: 4011. Event message: An unhandled access exception has occurred.

    Friday, September 30, 2011 8:42 AM
  • HI,

    This needs to be worked on.

    Go to the web.config of your web application and set CustomError=Off and EnableStackTrace=true .

    This will then capture full error details and we will be able to have better look.

    I hope this will help you out.


    Thanks, Rahul Rashu
    Saturday, October 1, 2011 10:42 AM
  • HI,

    The event code should be 401 and not 4011 can you confirm this? Also as suggested in the message above modify web.config of your web application to capture your details.

    carry out these changes:

    EnableStackTrace=True

    CustomError=Off

    I hope this will help you out.


    Thanks, Rahul Rashu
    Monday, October 3, 2011 2:48 AM