Showing posts with label FileInfo. Show all posts
Showing posts with label FileInfo. Show all posts

Wednesday, September 14, 2016

How to extract back up file?

To manually extract files

1. Open the Command Prompt window by clicking the Start button.
   In the search box, type Command Prompt, and then, in the list of results, click Command Prompt.
  
2. Type the following command:
C:\Users\Nagasai\Downloads>copy "Send_file_test.bak" “Send_file_test.mdb”

Hope this helps!!!

Wednesday, November 02, 2011

How to get current page Filename using C#

There are different ways to get current page filename using c#. Here are 3 methods you can use for your advantage.

Method 1
string currentPageFileName = new FileInfo(this.Request.Url.LocalPath).Name;

Method 2

string sPath = HttpContext.Current.Request.Url.AbsolutePath;
string[] strarry = sPath.Split('/');
int lengh = strarry.Length;
string sReturnPage = strarry[lengh - 1];

Method 3

string absPath = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
System.IO.FileInfo finfo = new System.IO.FileInfo(absPath);
string fileName = finfo.Name;

 

Out of these I like Method 1 and 3 as its straight forward. Use a per your advantage. Good luck.