Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I have a code which genrates an image based on data in table. It works fine on my Local system. When i deploy it on production i get no error but the image also is not getting displayed

Below is the code snippet which generates an image. Can you please guide me what can be the issue.


// Change the response headers to output a JPEG image.
this.Response.Clear();
            this.Response.ContentType = "image/jpeg";
            System.Drawing.Image OC = null;
            //Build the image 
            string imageName = Request.QueryString["ID"];

            if (Cache[imageName] != null)
            {
                OC = (System.Drawing.Image)Cache[imageName];
                // Write the image to the response stream in JPEG format.
                OC.Save(this.Response.OutputStream, ImageFormat.Jpeg);
                OC.Dispose();
            }
Posted
Updated 30-Dec-13 21:43pm
v2
Comments
JoCodes 31-Dec-13 4:47am    
Check the image path . use relative paths since the local and server paths wont be the same.Also check whether you have all the access permissions set .

1 solution

It could be that the IF condition is not reached, please put some code in the else block too. Example:
C#
else {this.Response.Write("Error"); }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900