![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Up to this point, our application has been using Windows File Sharing to transfer files to and from our application document repository. This approach does not lend itself toward a secure environment and so we are in the process of imposing a WebService gateway between our application client and the repository. (As a starting point, the WebService won't be a richly featured application server; business rules are still implemented in the client. But this will ensure that all access to the document repository is made via our software. Although the WebMethod below accepts only a single parameter, I'll shortly be adding authentication parameters to this method to ensure that accesses to this WebMethod actually originate from our client application.) Here is the method which I've defined (below). I have two questions, one which relates to functionality, and the other which relates to performance. 1. I can't get this to work! When I test this I get the following error message: Could not open C:\Winzip.log --> Access to the path "C:\Winzip.log" is denied. Here's the line of code on which the exception occurs: FileStream FS = new FileStream(FileSpec, FileMode.Open); I can't imagine that this is a Windows security problem. I have anonymous access disabled, integrated Windows authentication enabled, so the request must be running using my credentials and I'm able to open this file via the Windows shell. I imagine that perhaps I need to tweak a setting somewhere, but I'm not sure where. 2. Is this the quickest way to stream a file back to a remote client? Speedy delivery of the document to the client is critical and so anything that I can do to improve performance is important to me. Maybe conversion to Base64String is not as efficient? If I can use a more efficient format I will. Just bear in mind that I need to stream binary files (e.g. JPG) as well as textual, so I need a format which will preserve every bit as it travels via HTTP. Thanks very much for your advice! - Joe Geretz - [WebMethod] public string GetFileStream(string FileSpec) { try { FileStream FS = new FileStream(FileSpec, FileMode.Open); byte[] FileBytes = new byte[FS.Length]; FS.Read(FileBytes, 0, (int)FS.Length); FS.Close(); return System.Convert.ToBase64String(FileBytes, 0, FileBytes.Length); } catch (Exception e) { throw new Exception("Could not open " + FileSpec, e); } } |
#3
| |||
| |||
|
|
Up to this point, our application has been using Windows File Sharing to transfer files to and from our application document repository. This approach does not lend itself toward a secure environment and so we are in the process of imposing a WebService gateway between our application client and the repository. (As a starting point, the WebService won't be a richly featured application server; business rules are still implemented in the client. But this will ensure that all access to the document repository is made via our software. Although the WebMethod below accepts only a single parameter, I'll shortly be adding authentication parameters to this method to ensure that accesses to this WebMethod actually originate from our client application.) Here is the method which I've defined (below). I have two questions, one which relates to functionality, and the other which relates to performance. 1. I can't get this to work! When I test this I get the following error message: Could not open C:\Winzip.log --> Access to the path "C:\Winzip.log" is denied. |
#4
| |||
| |||
|
|
Why don't you just use Windows SharePoint Services. It's part of the OS, and that's what it's for. |
|
"Joseph Geretz" <jgeretz (AT) nospam (DOT) com> wrote in message news:uJhqnCYrFHA.1984 (AT) tk2msftngp13 (DOT) phx.gbl... Up to this point, our application has been using Windows File Sharing to transfer files to and from our application document repository. This approach does not lend itself toward a secure environment and so we are in the process of imposing a WebService gateway between our application client and the repository. (As a starting point, the WebService won't be a richly featured application server; business rules are still implemented in the client. But this will ensure that all access to the document repository is made via our software. Although the WebMethod below accepts only a single parameter, I'll shortly be adding authentication parameters to this method to ensure that accesses to this WebMethod actually originate from our client application.) Here is the method which I've defined (below). I have two questions, one which relates to functionality, and the other which relates to performance. 1. I can't get this to work! When I test this I get the following error message: Could not open C:\Winzip.log --> Access to the path "C:\Winzip.log" is denied. Is this file on the Client's filesystem or the Server's? Why don't you just use Windows SharePoint Services. It's part of the OS, and that's what it's for. David |
#5
| |||
| |||
|
|
However, the following directive doesn't work, even though I am logged in as SRS\Joseph. identity impersonate="true" userName="" password=""/ |
|
Hi David, Thanks for your response. The file is on the server. That's the whole point, we're imposing the WebService as a gateway between the server-side file repository and the clients. I am able to get access, by placing the following directive inside the Web.config file: identity impersonate="true" userName="SRS\Joseph" password="foobar"/ However, the following directive doesn't work, even though I am logged in as SRS\Joseph. identity impersonate="true" userName="" password=""/ I'm curious as to why the latter doesn't work. My site is set up to use integrated Windows authentication. Shouldn't the transaction be using the credentials SRS\Joseph in the latter case, just as it is in the former case? Why don't you just use Windows SharePoint Services. It's part of the OS, and that's what it's for. Sharepoint stores its files inside SQL Server. BLOB access is not as quick as native filesystem access. If we wanted to go that route, we'd have been storing our documents inside SQL Server a long time ago. Thanks, - Joe Geretz - "David Browne" <davidbaxterbrowne no potted meat (AT) hotmail (DOT) com> wrote in message news:%23qIZoJZrFHA.1984 (AT) tk2msftngp13 (DOT) phx.gbl... "Joseph Geretz" <jgeretz (AT) nospam (DOT) com> wrote in message news:uJhqnCYrFHA.1984 (AT) tk2msftngp13 (DOT) phx.gbl... Up to this point, our application has been using Windows File Sharing to transfer files to and from our application document repository. This approach does not lend itself toward a secure environment and so we are in the process of imposing a WebService gateway between our application client and the repository. (As a starting point, the WebService won't be a richly featured application server; business rules are still implemented in the client. But this will ensure that all access to the document repository is made via our software. Although the WebMethod below accepts only a single parameter, I'll shortly be adding authentication parameters to this method to ensure that accesses to this WebMethod actually originate from our client application.) Here is the method which I've defined (below). I have two questions, one which relates to functionality, and the other which relates to performance. 1. I can't get this to work! When I test this I get the following error message: Could not open C:\Winzip.log --> Access to the path "C:\Winzip.log" is denied. Is this file on the Client's filesystem or the Server's? Why don't you just use Windows SharePoint Services. It's part of the OS, and that's what it's for. David |
#6
| |||
| |||
|
|
Hi David, Thanks for your response. The file is on the server. That's the whole point, we're imposing the WebService as a gateway between the server-side file repository and the clients. I am able to get access, by placing the following directive inside the Web.config file: identity impersonate="true" userName="SRS\Joseph" password="foobar"/ However, the following directive doesn't work, even though I am logged in as SRS\Joseph. identity impersonate="true" userName="" password=""/ I'm curious as to why the latter doesn't work. My site is set up to use integrated Windows authentication. Shouldn't the transaction be using the credentials SRS\Joseph in the latter case, just as it is in the former case? Why don't you just use Windows SharePoint Services. It's part of the OS, and that's what it's for. Sharepoint stores its files inside SQL Server. BLOB access is not as quick as native filesystem access. If we wanted to go that route, we'd have been storing our documents inside SQL Server a long time ago. |
#7
| |||
| |||
|
|
Transfering over SOAP will require Base64 encoding and lots of memory on the server, as you've discovered. Which is a far cry from native filesystem access. |
|
Transfering over SOAP will require Base64 encoding |
|
"Joseph Geretz" <jgeretz (AT) nospam (DOT) com> wrote in message news:uNo3odZrFHA.3424 (AT) TK2MSFTNGP14 (DOT) phx.gbl... Hi David, Thanks for your response. The file is on the server. That's the whole point, we're imposing the WebService as a gateway between the server-side file repository and the clients. I am able to get access, by placing the following directive inside the Web.config file: identity impersonate="true" userName="SRS\Joseph" password="foobar"/ However, the following directive doesn't work, even though I am logged in as SRS\Joseph. identity impersonate="true" userName="" password=""/ I'm curious as to why the latter doesn't work. My site is set up to use integrated Windows authentication. Shouldn't the transaction be using the credentials SRS\Joseph in the latter case, just as it is in the former case? Why don't you just use Windows SharePoint Services. It's part of the OS, and that's what it's for. Sharepoint stores its files inside SQL Server. BLOB access is not as quick as native filesystem access. If we wanted to go that route, we'd have been storing our documents inside SQL Server a long time ago. Transfering over SOAP will require Base64 encoding and lots of memory on the server, as you've discovered. Which is a far cry from native filesystem access. David |
#8
| |||
| |||
|
|
Transfering over SOAP will require Base64 encoding ... |
|
"Joseph Geretz" <jgeretz (AT) nospam (DOT) com> wrote in message news:uNo3odZrFHA.3424 (AT) TK2MSFTNGP14 (DOT) phx.gbl... Hi David, Thanks for your response. The file is on the server. That's the whole point, we're imposing the WebService as a gateway between the server-side file repository and the clients. I am able to get access, by placing the following directive inside the Web.config file: identity impersonate="true" userName="SRS\Joseph" password="foobar"/ However, the following directive doesn't work, even though I am logged in as SRS\Joseph. identity impersonate="true" userName="" password=""/ I'm curious as to why the latter doesn't work. My site is set up to use integrated Windows authentication. Shouldn't the transaction be using the credentials SRS\Joseph in the latter case, just as it is in the former case? Why don't you just use Windows SharePoint Services. It's part of the OS, and that's what it's for. Sharepoint stores its files inside SQL Server. BLOB access is not as quick as native filesystem access. If we wanted to go that route, we'd have been storing our documents inside SQL Server a long time ago. Transfering over SOAP will require Base64 encoding and lots of memory on the server, as you've discovered. Which is a far cry from native filesystem access. David |
#9
| |||
| |||
|
|
And one more follow up question: Transfering over SOAP will require Base64 encoding ... So if I download a PDF from the web, or stream an audio / video file over the web it always travels in Base64 format? Is there a more compact way in which this can be transmitted in binary format? |
#10
| |||
| |||
|
|
"Joseph Geretz" <jgeretz (AT) nospam (DOT) com> wrote in message news:OKlwblarFHA.2588 (AT) tk2msftngp13 (DOT) phx.gbl... And one more follow up question: Transfering over SOAP will require Base64 encoding ... So if I download a PDF from the web, or stream an audio / video file over the web it always travels in Base64 format? Is there a more compact way in which this can be transmitted in binary format? Yes. HTTP is a binary protocol, ASMX web service use SOAP and are XML (text) over HTTP. It's quite easy to send/recieve binary files directly over HTTP. In ASP.NET you can access the request/response stream objects and write bytes to the wire directly. http://www.codeproject.com/aspnet/fileupload.asp http://www.ondotnet.com/pub/a/dotnet...04/01/asp.html http://www.15seconds.com/issue/010504.htm You can also send binary files using web services, but you need an enhanced web services implementation on client and server like Microsoft Web Services Enhancements 2.0 http://msdn.microsoft.com/webservice...e/default.aspx Which impmenents Direct Internet Message Encapsulation DIME for attaching binary messages to web services. http://msdn.microsoft.com/library/de...ml/wsedime.asp David |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |