Click here to Skip to main content
16,007,885 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I create a folder in server at run time but I can't save its website path it saves the system drive path
please help me to save websites server path.


I use following code.

C#
string path = Server.MapPath("furniture_main/" + TxtFolderName.Text.ToString());
if (Directory.Exists(path))
   LblError.Text = "FOlder is exists!";
else
   try
   {
      Directory.CreateDirectory(path);
      #region Save_Folder_Path_And_Name
      string strmain = "usp_create_main_Folder";
      SqlParameter[] ins_param ={
         new SqlParameter("@FolderName",TxtFolderName.Text.Trim()),
         new SqlParameter("@FolderPath",path)
         };


      int result = DU.executeprocedure(strmain, ins_param);
      if (result > 0)
      {
         LblError.Text = "Folder Create!";
      }
       
      #endregion
   }
   catch
   {
      LblError.Text = "Error: on directory creation!";
   }


[edit]indexation changed to improve readability[/edit]
Posted
Updated 21-Nov-13 21:55pm
v3

1 solution

For getting the current website url in asp.net


Quote:
HttpContext.Current.Request.Url.AbsoluteUri


It will return the current webpage url.

ex:
http://www.codeproject.com/Questions/686138/I-create-a-folder-in-server-at-run-time-but-I-cant
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900