472,378 Members | 1,324 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 software developers and data experts.

Rendering in-memory images from UNC file share

I have this same problem, and I've *half-way* resolved it. It turns
out that this is not exactly an IO problem; it's actually a security
issue and maybe even an ASP.NET bug. Here is what I've done so far...

1. Learned from this post that there are problems with the FromFile
method when using a UNC share as the source directory:
http://tinyurl.com/8exos.

2. Adapted the code in the post to:
'\\\
Dim objStream As New FileStream(SourcePath, _
FileMode.Open, FileAccess.Read)
Dim bmp As Bitmap = Bitmap.FromStream(objStream)
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Tiff)

' Send out through response.
With ParentPage
'.Response.ContentType = "image/jpeg"
.Response.ContentType = "image/tiff"
.Response.BinaryWrite(ms.GetBuffer)
.Response.End()
End With

objStream.Close()
'///

3. Added the relevant URLs to Internet Explorer's list of Trusted Sites
(http://localhost, http://127.0.0.1, etc.).

4. Removed anonymous authentication within IIS for the application's
directory.

5. Added the <identity impersonate="true" /> tag to the Web.config to
enable NT integrated security with impersonation.

THE RESULT

My application now works as expected when I am physically on the box
that hosts my application (i.e., when I RDP into the server). However,
when I try to access it from my workstation, I still get the
FileNotFoundException (even after adding the server's URL to my local
list of Trusted Sites).

It is as if ASP.NET "loses" the NT authentication token when servicing
the client's request for a remote file.

Any ASP.NET security gurus have an idea on this one??

Thanks,

Eric

bu*************@gmail.com wrote:
I'm having a strange error message with ASP.NET image function.
Basically sometimes it will find the image path, sometimes it won't.
The logic here is that the script iterates through an access table,
pulls the image file name from the database, appends a subdirectory
path to this name, and then writes some html to display the image. But,
like, half the time I get the included error message, and I have no
idea why. When I was developing the page, I could get it to work by,
get this, copying all the relevant files to a new directory and then
restarting the web matrix web server, using that new path. Now, the
webmaster and myself are trying to put this on the actual web server
running IIS, and this message won't go away. If you want to see my code
you can actually look at it here when I posted it for critique, hehe:
http://groups-beta.google.com/group/...674a830f9b23ca

Anyways, TIA. Here is the error message:
Server Error in '/' Application.
--------------------------------------------------------------------------------

thumbnails/_DSC0833.JPG
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException:
thumbnails/_DSC0833.JPG

Source Error:

Line 182: id = objDR("id")
Line 183: name = objDR("name")
Line 184: currentImage =
System.Drawing.Image.FromFile(path)
Line 185: imgHeight = currentImage.Height/2
Line 186: imgWidth = currentImage.Width/2
Source File: E:\Webs\SPDemo\webimages\logo\index.aspx Line: 184

Stack Trace:

[FileNotFoundException: thumbnails/_DSC0833.JPG]
System.Drawing.Image.FromFile(String filename, Boolean
useEmbeddedColorManagement) +205
System.Drawing.Image.FromFile(String filename) +7
ASP.index_aspx.Draw_index() in
E:\Webs\SPDemo\webimages\logo\index.aspx:184
ASP.index_aspx.Page_Load(Object Source, EventArgs E) in
E:\Webs\SPDemo\webimages\logo\index.aspx:530
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

Nov 19 '05 #1
0 1330

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: eeyimaya | last post by:
Hello, I read from sun site about fullscreen mode and active rendering and now I am in doubt! is active rendering for only fullscreen applications? I am planning to develop an windowed application...
6
by: David Opstad | last post by:
I have a question about text rendering I'm hoping someone here can answer. Is there a way of doing linguistically correct rendering of Unicode strings in Python? In simple cases like Latin or...
3
by: Beetlegeuse | last post by:
Here is a screenshot of three different versions of rendering of the trouble area: http://img371.imageshack.us/img371/2572/layout8xg.gif (ignore the language of the text) The first...
0
by: haust | last post by:
Hi, for my D3D C# editor i'm using a simple panel control as the target window for rendering (the Paint method is overriden). I have a problem when it come to smoothly updating the view. I'm...
0
by: John | last post by:
Hi all, I have Acrobat reader 6 installed as I usually do. I've recently had to reinstall Windows and associated programmes and have my web apps up and running except for the PDF rendering. The...
7
by: Dennis Benzinger | last post by:
Hi! Does anybody know of a SVG rendering library for Python? Bye, Dennis
4
by: David R | last post by:
Using this CSS: ------------------------ button { border: none; background: url("Button-LU.gif") center center; padding: 0; text-align: center; margin: 0.5em;
1
by: Ricardo Quintanilla G. | last post by:
how to override the rendering method of a whole asp.net applicaction? i want to not include spaces between html elements. As example, then rendering produce that: == == == == <html> <body>...
12
by: Boris Borcic | last post by:
Hello, I am trying to use UI Automation to drive an MS Windows app (with pywinauto). I need to scrape the app's window contents and use some form of OCR to get at the texts (pywinauto can't...
1
by: ChrisN | last post by:
I have a requirement to generate and print good-looking customised correspondence. I would like to be able to use mark-up for formatting, ie as a MS Word or HTML document. However Word...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.