Ovi
Ovi

Reputation: 2559

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

Upvotes: 0

Views: 7733

Answers (3)

alok_dida
alok_dida

Reputation: 1723

You need to add permissions for ASPNET user. It will work for sure.

Upvotes: 0

Kimtho6
Kimtho6

Reputation: 6184

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

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

Upvotes: 3

Tim B James
Tim B James

Reputation: 20364

try

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

Or you can use an absolute path

bitmap.Save("c:\inetpub\wwwroot\mySite\img\bitmap.png");

Note that the path is just an example and should be your absolute path.

Upvotes: 1

Related Questions