1

I have been working on an asp.net webapp that draws a blue line on an image of a time-schedule depending on what activity you are doing during the day . Everything works fine when I'm debugging the program on my local machine, however when I moved it to the webserver earlier today, and tried it for real, the blue lines do not appear.

For example, you jog from 9 to 10am, then eat from 10 to 11am, the blue line would draw from 9 to 10 horizontally across the jog section, then draw vertically to the eating section and then draw horizontally to 11:00. I do this on an jpg image of a time-schedule grid, then save and load the new drawn-on image to the image-control on the screen.

Any ideas why this doesn't work on the webserver?

Bitmap image = new Bitmap(Server.MapPath("~") + "/Assets/img/grid.jpg");
Graphics graphics = Graphics.FromImage(image);
Pen p = new Pen(Color.Blue, 5);
//graphics.drawline(pen, X1, Y1, X2, Y2)
image.Save(Server.MapPath("~") + "/Assets/img/grids/" + id + "newgrid.jpg");
imgGrid.ImageUrl = "~/Assets/img/grids/" + id + "newgrid.jpg";
Jake Gaston
  • 211
  • 2
  • 7
  • 19
  • I had a similar problem with graphics running differently on the remote server to the local (http://stackoverflow.com/questions/2561901/c-sharp-graphics-rotatetransform-works-on-localhost-but-not-on-remote-server). Sadly, I never did solve it. – harriyott Jun 11 '12 at 18:01

1 Answers1

1

Drawing API are not supported/guaranteed to work in server environment (this is more theoretical issue, normally work ok) - check out System.Drawing in Windows or ASP.NET services.

Likely you have issues reading or writing files. Add tracing to your code and see if you have any exceptions.

Community
  • 1
  • 1
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179