Search code examples
c#asp.netsave-image

Save a image from asp.net website


,Hope i get this clear.

I have a asp.net website, as part of it i generate a bitmap and need to save it some were so i can display it later on.

for now my sites is locate here:

http://tools.myDomain.com/mySite/

I have created a directory with in my site:

http://tools.myDomain.com/mySite/img/

Now i am trying to save my bitmap to there like this:

bitmap.Save(@"http://tools.myDomain.com/mySite/img/bitmap.png");

I can get this to work, not from my computer locally and not when i do Publish to my site...

Any ideas how can i fix this problem?

Thank you


Solution

  • You need to save it on the server not on the web

    bitmap.Save(HttpContext.Current.Server.MapPath("/img/bitmap.png"));