G
Guest
Hi - I create a input box as follows:
<INPUT id="inpJobDescEmpSpec" style="BORDER-RIGHT: gray thin solid;
BORDER-TOP: gray thin solid; Z-INDEX: 181; LEFT: 232px; BORDER-LEFT: gray
thin solid; WIDTH: 640px; BORDER-BOTTOM: gray thin solid; POSITION: absolute;
TOP: 400px; HEIGHT: 22px" tabIndex="27" type="file" maxLength="250" size="87"
name="inpJobDescEmpSpec" RunAt="Server">
to allow the user to select a file which I want saved to a SQL Server
database.
On the save I then run this code to insert the document into the database:
'only try and attach file if there is one specified
Dim impersonationContext As
System.Security.Principal.WindowsImpersonationContext
Dim currentWindowsIdentity As
System.Security.Principal.WindowsIdentity
currentWindowsIdentity = CType(User.Identity,
System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()
'Insert your code that runs under the security context of
the authenticating user here.
If Len(Trim(inpJobDescEmpSpec.Value)) <> 0 Then
Dim fs As New System.IO.FileStream _
(inpJobDescEmpSpec.Value,
System.IO.FileMode.OpenOrCreate, _
System.IO.FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, fs.Length)
fs.Close()
.JobDescEmpSpecDoc = MyData
.UpdateDocument = True
Else
Dim MyData(0) As Byte
.JobDescEmpSpecDoc = MyData
.UpdateDocument = False
End If
impersonationContext.Undo()
(where I am setting MyData to a byte property of my data class)
This works perfectly fine in the development environment (my PC has Visual
Studio and is the web server connectin to a SQL server database on out
network.
I can browse for and attach files with or network paths (C:\Folder\File.doc
or \\Server\Share\Folder\File.doc)
If I connect to the website on my PC from another PC the local drive upload
works fine (C:\Folder\File.doc) but the network upload fails because
somewhere along the way the backslashes are beibng removed so it is trying to
access file \ServerShareFolderFile.doc
Anyone any idea why this is?
Thanks in advance
Siobhan
<INPUT id="inpJobDescEmpSpec" style="BORDER-RIGHT: gray thin solid;
BORDER-TOP: gray thin solid; Z-INDEX: 181; LEFT: 232px; BORDER-LEFT: gray
thin solid; WIDTH: 640px; BORDER-BOTTOM: gray thin solid; POSITION: absolute;
TOP: 400px; HEIGHT: 22px" tabIndex="27" type="file" maxLength="250" size="87"
name="inpJobDescEmpSpec" RunAt="Server">
to allow the user to select a file which I want saved to a SQL Server
database.
On the save I then run this code to insert the document into the database:
'only try and attach file if there is one specified
Dim impersonationContext As
System.Security.Principal.WindowsImpersonationContext
Dim currentWindowsIdentity As
System.Security.Principal.WindowsIdentity
currentWindowsIdentity = CType(User.Identity,
System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()
'Insert your code that runs under the security context of
the authenticating user here.
If Len(Trim(inpJobDescEmpSpec.Value)) <> 0 Then
Dim fs As New System.IO.FileStream _
(inpJobDescEmpSpec.Value,
System.IO.FileMode.OpenOrCreate, _
System.IO.FileAccess.Read)
Dim MyData(fs.Length) As Byte
fs.Read(MyData, 0, fs.Length)
fs.Close()
.JobDescEmpSpecDoc = MyData
.UpdateDocument = True
Else
Dim MyData(0) As Byte
.JobDescEmpSpecDoc = MyData
.UpdateDocument = False
End If
impersonationContext.Undo()
(where I am setting MyData to a byte property of my data class)
This works perfectly fine in the development environment (my PC has Visual
Studio and is the web server connectin to a SQL server database on out
network.
I can browse for and attach files with or network paths (C:\Folder\File.doc
or \\Server\Share\Folder\File.doc)
If I connect to the website on my PC from another PC the local drive upload
works fine (C:\Folder\File.doc) but the network upload fails because
somewhere along the way the backslashes are beibng removed so it is trying to
access file \ServerShareFolderFile.doc
Anyone any idea why this is?
Thanks in advance
Siobhan