Writing text file on local server MVC 2.0
- by Liado
Hi, i'm trying to write a text file on remote server,
i'm using the following code:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(UserModels model)
{
if (!ModelState.IsValid)
{
return View("Index");
}
try
{
using (StreamWriter w = new StreamWriter(Server.MapPath(TEXT_FILE_NAME), true))
{
w.WriteLine(model.Email.ToString()); // Write the text
}
}
catch
{
}
the folder is still empty, can someone help? what should be the problem?
Thanks