FILES NEEDE TO UPLOADED IN SERVER

Posted by Parthibansk under IIS on 8/23/2012 | Points: 10 | Views : 924 | Status : [Member] | Replies : 1
i have uploaded .aspx, .cs files in server...wen i run the page am not able connect to database..

do we have 2 upload web.config file and .mdf file in server.. and how to give access in iis..




Responses

Posted by: Nadh123 on: 8/23/2012 [Member] Starter | Points: 25

Up
0
Down
string rootpath = "~/rootpath";
FileInfo TheFile = new FileInfo(MapPath(rootpath) + "\\" + FileUpload1.FileName);
if (TheFile.Exists)
{
FileInfo TheModiFile = new FileInfo(MapPath("~/Private/ModifiedFiles/") + "\\" + FileUpload1.FileName);
if (TheModiFile.Exists)
{
File.Delete(MapPath("~/Private/ModifiedFiles/") + "\\" + FileUpload1.FileName);
File.Move(MapPath(rootpath) + "\\" + FileUpload1.FileName, MapPath("~/Private/ModifiedFiles/") + "\\" + FileUpload1.FileName);
}
else
{
File.Move(MapPath(rootpath) + "\\" + FileUpload1.FileName, MapPath("~/Private/ModifiedFiles/") + "\\" + FileUpload1.FileName);
}
FileUpload1.SaveAs(Server.MapPath(rootpath + FileUpload1.FileName));
}
else
{
FileUpload1.SaveAs(Server.MapPath(rootpath) + FileUpload1.FileName);
}

Mahendra
91-9908699686

Parthibansk, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response