I have a website that is using ASP.NET and C#.
I am trying to do something like this
bitmap.Save(@"C:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\Images\" + imageName + ".png")
But I dont want to have to write that whole path, since it changes from computer to computer.
How can I get the full path with C#? (this path is were the application is currently being saved)
Use this:
bitmap.Save(System.IO.Path.Combine(Server.MapPath("~/RELATIVE PATH OF YOUR APPLICATION"), imageName + ".png"));
Or some of properties of HttpContext.Current.Request (ApplicationPath or AppDomain.CurrentDomain.BaseDirectory, for example)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With