How to find folder or file path in the server using ASP.NET with c#?


 For finding folder or file path in the server, we have to use System.Web.HttpContext.Current.Server.MapPath("").


   protected void Page_Load(object sender, EventArgs e)
    {
        string imgName = "RangaRajesh.jpg";
        string strFilePath=System.Web.HttpContext.Current.Server.MapPath("~") + "\\images\\"+imgName;
        //output is : D:\\Ranga Rajesh Kumar\\practice1\\images\\RangaRajesh.jpg
    }
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar