Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

DotNetNuke Marketplace
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
Engage Software - Training Partner for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

telerik
ExactTarget email software solutions
Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
Salaro -- Skins and more
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  Links Module [L...  PDFs Do Not Open In Browser
Previous Previous
 
Next Next
New Post 6/11/2007 10:33 AM
User is offline anonymous
0 posts
Unranked


Re: PDFs Do Not Open In Browser 

Since this is an issue with a core user control and outside the control of this module, you can consider this THE solution. If the core team investigates the issue further and finds a solution, then there hopefully will be no need for this solution anymore.

 
New Post 6/13/2007 6:53 AM
User is offline drowzee
3 posts
www.gyrussolutions.com/
10th Ranked


Re: PDFs Do Not Open In Browser 

Problem is in DNN core. You can to use 2 ways to resolve it:

1. Enable File AutoSync feature in DNN

2. Change method DownloadFile(ByVal PortalId As Integer, ByVal FileId As Integer, ByVal ClientCache As Boolean, ByVal ForceDownload As Boolean) in FileSystemUtils.vb to following:

 

Public Shared Function DownloadFile(ByVal PortalId As Integer, ByVal FileId As Integer, ByVal ClientCache As Boolean, ByVal ForceDownload As Boolean) As Boolean
            Dim blnDownload As Boolean = False

            ' get file
            Dim objFiles As New FileController
            Dim objFile As DotNetNuke.Services.FileSystem.FileInfo = objFiles.GetFileById(FileId, PortalId)
            Dim strFile As String = ""

            Select Case objFile.StorageLocation
                Case FolderController.StorageLocationTypes.InsecureFileSystem
                    strFile = objFile.PhysicalPath
                Case FolderController.StorageLocationTypes.SecureFileSystem
                    strFile = objFile.PhysicalPath & glbProtectedExtension
            End Select

            Dim objFileInfo As System.IO.FileInfo = New System.IO.FileInfo(strFile)

            If Not objFile Is Nothing Then
                ' check folder view permissions
                If PortalSecurity.IsInRoles(FileSystemUtils.GetRoles(objFile.Folder, PortalId, "READ")) Then
                    ' auto sync
                    Dim blnFileExists As Boolean = True
                    If DotNetNuke.Entities.Host.HostSettings.GetHostSetting("EnableFileAutoSync") <> "N" Then
                        If strFile <> "" Then
                            ' synchronize file
                            If objFileInfo.Exists Then
                                If objFile.Size <> objFileInfo.Length Then
                                    objFile.Size = CType(objFileInfo.Length, Integer)
                                    UpdateFileData(FileId, objFile.FolderId, PortalId, objFile.FileName, objFile.Extension, GetContentType(objFile.Extension), objFileInfo.Length, objFile.Folder)
                                End If
                            Else ' file does not exist
                                RemoveOrphanedFile(objFile, PortalId)
                                blnFileExists = False
                            End If
                        End If
                    End If

                    ' download file
                    If blnFileExists Then
                        ' save script timeout
                        Dim scriptTimeOut As Integer = HttpContext.Current.Server.ScriptTimeout

                        ' temporarily set script timeout to large value ( this value is only applicable when application is not running in Debug mode )
                        HttpContext.Current.Server.ScriptTimeout = Integer.MaxValue

                        Dim objResponse As HttpResponse = HttpContext.Current.Response

                        objResponse.ClearContent()
                        objResponse.ClearHeaders()

                        ' force download dialog
                        If ForceDownload Then
                            objResponse.AppendHeader("content-disposition", "attachment; filename=""" + objFile.FileName + """")
                        Else
                            'use proper file name when browser forces download because of file type (save as name should match file name)
                            objResponse.AppendHeader("content-disposition", "inline; filename=""" + objFile.FileName + """")
                        End If
                        objResponse.AppendHeader("Content-Length", objFileInfo.Length.ToString())
                        objResponse.ContentType = GetContentType(objFile.Extension.Replace(".", ""))

                        'Stream the file to the response
                        Dim objStream As IO.Stream = FileSystemUtils.GetFileStream(objFile)
                        Try
                            WriteStream(objResponse, objStream)
                        Catch ex As Exception
                            ' Trap the error, if any.
                            objResponse.Write("Error : " & ex.Message)
                        Finally
                            If IsNothing(objStream) = False Then
                                ' Close the file.
                                objStream.Close()
                            End If
                        End Try

                        objResponse.Flush()
                        objResponse.End()

                        ' reset script timeout
                        HttpContext.Current.Server.ScriptTimeout = scriptTimeOut

                        blnDownload = True
                    End If
                End If
            End If

            Return blnDownload

        End Function

 

I'm sorry if there are problems in my code. I'm not VB guru

 
New Post 6/19/2007 9:00 AM
User is offline Kmideas
65 posts
10th Ranked


Re: PDFs Do Not Open In Browser 

I downloaded the latest Acrobat Reader 8.0 and it now displays PDFs from DNN.

 
New Post 6/19/2007 2:28 PM
User is offline drowzee
3 posts
www.gyrussolutions.com/
10th Ranked


Re: PDFs Do Not Open In Browser 

 kmideas wrote

I downloaded the latest Acrobat Reader 8.0 and it now displays PDFs from DNN.

 

Error occurs only if size stored in database is not equal real size of file. So version of Acrobat Reader is not significant.

 
New Post 6/19/2007 5:06 PM
User is offline Kmideas
65 posts
10th Ranked


Re: PDFs Do Not Open In Browser 

All I know is that I can view PDFs whereas I couldn't before.

 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  Links Module [L...  PDFs Do Not Open In Browser
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


SINA101
WANT A SPECial sIte iN TAIWAN?
sina101.com
Web Development and Strategy Firm
The Risdall Interactive Agency s websites, strategies, branding, & promotion in digital space.
www.Risdall.net/
Windsor Management Group
Fund Accounting Software for K12 Education.
Infinitevisions.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP