Hi! Patrice,
Thanks for the response. I am using filestream to read the file like
Dim strFilePath As String
Dim strFileName As String
Dim fsFile As FileStream
Dim strFileExtn As String
Dim strMIMEType As String
Dim lnFileSize As Long
strFileName = "XXXX_050601105 406_DIA.JPG"
strFilePath = "\\<Network Server Name>\<folder
Name>\XXXX_0506 01105406_DIA.JP G"
strFileExtn = strFileName.Sub string(strFileN ame.LastIndexOf (".") + 1)
Select Case strFileExtn.ToU pper()
Case "AU", "SND"
strMIMEType = "audio/basic"
Case "WAV"
strMIMEType = "audio/wav"
Case "RA", "RM", "RAM"
strMIMEType = "audio/x-pn-realaudio"
Case "MID", "MIDI"
strMIMEType = "audio/x-midi"
Case "MP3"
strMIMEType = "audio/mp3"
Case "M3U"
strMIMEType = "audio/m3u"
Case "TXT", "TEXT", "VBS", "ASP", "CGI", "PL", "NFO", "ME", "DTD"
strMIMEType = "text/plain"
Case "HTM", "HTML", "HTA", "HTX", "MHT"
strMIMEType = "text/html"
Case "JS"
strMIMEType = "text/javascript"
Case "CSS"
strMIMEType = "text/css"
Case "PDF"
strMIMEType = "applicatio n/pdf"
Case "RTF"
strMIMEType = "applicatio n/rtf"
Case "XML", "XSL", "XSLT"
strMIMEType = "text/xml"
Case "WPD"
strMIMEType = "applicatio n/wordperfect"
Case "WRI"
strMIMEType = "applicatio n/mswrite"
Case "XLS", "XLS3", "XLS4", "XLS5", "XLW"
strMIMEType = "applicatio n/msexcel"
Case "DOC"
strMIMEType = "applicatio n/msword"
Case "PPT", "PPS"
strMIMEType = "applicatio n/mspowerpoint"
Case "WML"
strMIMEType = "text/vnd.wap.wml"
Case "WMLS"
strMIMEType = "text/vnd.wap.wmlscri pt"
Case "WBMP"
strMIMEType = "image/vnd.wap.wbmp"
Case "WMLC"
strMIMEType = "applicatio n/vnd.wap.wmlc"
Case "WMLSC"
strMIMEType = "applicatio n/vnd.wap.wmlscri ptc"
Case "GIF"
strMIMEType = "image/gif"
Case "JPG", "JPE", "JPEG"
strMIMEType = "image/jpeg"
Case "PNG"
strMIMEType = "image/png"
Case "BMP"
strMIMEType = "image/bmp"
Case "TIF", "TIFF"
strMIMEType = "image/tiff"
Case "AI", "EPS", "PS"
strMIMEType = "applicatio n/postscript"
Case "ASF"
strMIMEType = "video/x-ms-asf"
Case "AVI"
strMIMEType = "video/avi"
Case "MPG", "MPEG"
strMIMEType = "video/mpeg"
Case "QT", "MOV", "QTVR"
strMIMEType = "video/quicktime"
Case "SWA"
strMIMEType = "applicatio n/x-director"
Case "SWF"
strMIMEType = "applicatio n/x-shockwave-flash"
Case "ZIP"
strMIMEType = "applicatio n/x-zip-compressed"
Case "GZ"
strMIMEType = "applicatio n/x-gzip"
Case "RAR"
strMIMEType = "applicatio n/x-rar-compressed"
Case "COM", "EXE", "DLL", "OCX"
strMIMEType = "applicatio n/octet-stream"
Case Else
strMIMEType = "applicatio n/octet-stream"
End Select
Response.Clear( )
Response.Conten tType = strMIMEType
Response.AddHea der("content-disposition", "attachment;fil ename=" +
strFileName)
fsFile = New FileStream(strF ilePath, FileMode.Open)
lnFileSize = fsFile.Length
Dim getContent(CInt (lnFileSize)) As Byte
fsFile.Read(get Content, 0, CInt(fsFile.Len gth))
fsFile.Close()
Response.Binary Write(getConten t)
Response.End()
It's working fine when i am viewing a page without user authentications .
In my project, different user's have username and encrypted passwords. On
valid authentication user is allowed to go into the site. Here the problem
occours when the user is trying to view the files, whereas if user downloads
the file, its downloads properly with the correct file.
Thanks,
Baren
"Patrice" wrote:
Is the "localhost" location correct ? If not you'll have likely to fix how
the path is build
How do you want to download this file ? Do you want a direct link to a file
share ? My personal preference is to stream the file using the server side
page (using Response.WriteF ile).
Patrice
--
"Baren" <Ba***@discussi ons.microsoft.c om> a écrit dans le message de
news:EA******** *************** ***********@mic rosoft.com... Hi!
I am using impersonate="tr ue" to upload and download files from a network
share.
I have created common users on both the webserver and the file server. The
user has permission to the files server folder.
I am able to upload the files into the fileserver, but while downloading
the same i am getting error "file doesn't exist" and the path it shows is
localhost temporary internet files.
Please help
Thanks in advance,