lpatnaik
Programmer
- Jul 11, 2002
- 53
I am using a user control to list a couple of files
dynamically generated by the user. Now if the user wishes
to download any file, he just needs to click on that link
which submits the parent page(in which user control is
embedded) to the server while updating a hidden variable
value to track this specific process (All through
javascript.)
Now i am facing with this problem:
When i click on the link , the alert "you are
downloading thsi filee....... do you want to save or
open. " I click on save the save/dialog box opens. I click
on cancel then without saving. On doing this, it gives me an Access Denied alert for any
other operation.
I am sending my code.
P.S: My test page is working fine . But my actual
page is one of the frames in the main window. Its in this
case that the error can be reproduced.
My Code---------------------------------------------------
Sub DownloadSelectedFile()
Dim strFilename As String = Request.Form("h_uc_Filename"
Dim fileInfo As FileInfo
Dim intStartPos As Long = 0, intFileSize As Long, intEndPos As Long
fileInfo = New FileInfo(strFilename)
Response.ClearContent()
Response.ClearHeaders()
Response.Clear()
'Response.AddHeader("Content-Length", fileInfo.Length.ToString())
Response.AppendHeader("Content-Disposition", "attachment; filename=""" & fileInfo.Name & """"
Response.ContentType = "application/octet-stream"
Response.WriteFile(fileInfo.FullName)
Response.End()
End Sub
dynamically generated by the user. Now if the user wishes
to download any file, he just needs to click on that link
which submits the parent page(in which user control is
embedded) to the server while updating a hidden variable
value to track this specific process (All through
javascript.)
Now i am facing with this problem:
When i click on the link , the alert "you are
downloading thsi filee....... do you want to save or
open. " I click on save the save/dialog box opens. I click
on cancel then without saving. On doing this, it gives me an Access Denied alert for any
other operation.
I am sending my code.
P.S: My test page is working fine . But my actual
page is one of the frames in the main window. Its in this
case that the error can be reproduced.
My Code---------------------------------------------------
Sub DownloadSelectedFile()
Dim strFilename As String = Request.Form("h_uc_Filename"
Dim fileInfo As FileInfo
Dim intStartPos As Long = 0, intFileSize As Long, intEndPos As Long
fileInfo = New FileInfo(strFilename)
Response.ClearContent()
Response.ClearHeaders()
Response.Clear()
'Response.AddHeader("Content-Length", fileInfo.Length.ToString())
Response.AppendHeader("Content-Disposition", "attachment; filename=""" & fileInfo.Name & """"
Response.ContentType = "application/octet-stream"
Response.WriteFile(fileInfo.FullName)
Response.End()
End Sub