Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...DNN 4.5.3 JavaScript Issue I ThinkDNN 4.5.3 JavaScript Issue I Think
Previous
 
Next
New Post
5/8/2008 9:42 PM
 

I have buit a simple  custom module that allows a user to click a calendar date in order to stream a file to his/her browser. I use the code below to stream the file.

The streaming works well and all, but if for instance I select 'Logout' after the file is downloaded, instead of logging out it wants to stream the file again. And the same thing occurs if I want to change the to another month in the calendar. If I browse to the Home page then I can logout successfully or return to the page to switch months in the calendar.

 

 

 

 

 

 

 

System.Web.HttpContext.Current.Response.Clear();System.Web.HttpContext.Current.Response.ClearHeaders();System.Web.HttpContext.Current.Response.ClearContent();System.Web.HttpContext.Current.Response.AddHeader("Content-disposition", "attachment; filename=" + fileName);System.Web.HttpContext.Current.Response.ContentType = "application/pdf";System.Web.HttpContext.Current.Response.BinaryWrite(results);HttpContext.Current.ApplicationInstance.CompleteRequest();

 
New Post
5/9/2008 10:10 AM
 

Anyone?

Essentially, after the file is streamed to the browser, in order to have the logout button or calendar work correctly, I have to post back to the server at least once.

 
New Post
5/9/2008 11:07 AM
 

Hmmm... this morning the logout button now works. The calendar however still behaves the same way.

 
New Post
5/9/2008 11:36 AM
 

This is code used in my filemanager for downloading.  It's modified from DNN core filedownload, which was modified from the DNN 2.x version of my filemanager before the re-write.  I know I tried several other methods for sending the file to the client, and this so far seems to work best.

Dim objResponse As HttpResponse = HttpContext.Current.Response
objResponse.ClearContent()
objResponse.ClearHeaders()
objResponse.AppendHeader("content-disposition", "attachment; filename=""" + finfo.Name + """")
objResponse.AppendHeader("Content-Length", finfo.Length.ToString())
objResponse.ContentType = strGetContentType(finfo.Extension)

Dim fileStream As Stream = Nothing
fileStream = New FileStream(finfo.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)

Dim objStream As IO.Stream = fileStream
Try
 WriteStream(objResponse, objStream)
Catch ex As Exception

  objResponse.Write("Error : " & ex.Message)

Finally
 If IsNothing(objStream) = False Then
        ' Close the file.
         objStream.Close()
         End If
End Try

 objResponse.Flush()
        objResponse.End()


 

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...DNN 4.5.3 JavaScript Issue I ThinkDNN 4.5.3 JavaScript Issue I Think


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, 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 DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out