ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.What is Server.MapPath in ASP.Net<blockquote><cite>KatieNgoc says:</cite> <div class="line number36 index35 alt1"><code class="csharp spaces">&nbsp;</code><code class="csharp keyword">string</code> <code class="csharp plain">filePath = </code><code class="csharp string">"~/Files/"</code> <code class="csharp plain">+ Path.GetFileName(</code><code class="csharp string">"E-Sign.png"</code><code class="csharp plain">);</code></div> <div class="line number37 index36 alt2"><code class="csharp spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="csharp keyword">byte</code><code class="csharp plain">[] bytes = File.ReadAllBytes(Server.MapPath(filePath));</code></div> </blockquote> <p>File E-Sign.png is inside projects Files folder.</p> <p>Change above line with the below.</p> <pre class="brush: csharp">string filePath = &#34;~/Files/E-Sign.png&#34;; byte[] bytes = File.ReadAllBytes(Server.MapPath(filePath))</pre> <p>Server.MapPath specifies the relative or virtual path to map to a physical directory.</p> <p>Server.MapPath("~") returns the physical path to the root of the application.</p>https://www.aspforums.net:443/Threads/858420/What-is-ServerMapPath-in-ASPNet/https://www.aspforums.net:443/Threads/858420/What-is-ServerMapPath-in-ASPNet/Thu, 05 Sep 2019 00:33:03 GMT