简体   繁体   中英

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

您需要将其保存在服务器上而不是网络上

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM