Writing text file on local server MVC 2.0

Posted by Liado on Stack Overflow See other posts from Stack Overflow or by Liado
Published on 2010-05-20T09:28:09Z Indexed on 2010/05/20 12:20 UTC
Read the original article Hit count: 193

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about text