473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 1375

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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.