ASP.NET - ASP.NET MVC alojado en asphostportal.com

 
Vista:
sin imagen de perfil

ASP.NET MVC alojado en asphostportal.com

Publicado por helena (1 intervención) el 01/08/2016 09:39:41
He estado trabajando en un sitio Web ASP.NET MVC y se encuentra alojada en asphostportal.com puede enviar directamente un formulario de consulta a un correo electrónico específico en la web que estoy haciendo, está funcionando perfectamente bien, la forma es el envío sin problemas, hasta que acogió. Cada vez que intento enviar un formulario, sigo recibiendo este error:

System.IO.DirectoryNotFoundException: Could not find a part of the path 'G:\PleskVhosts\sellurs.com\httpdocs\App_Data\uploads\SOS.docx'

Pero cuando intento ejecutar mi proyecto que no es, todavía es el envío de la forma sin problema. ¿Por qué es? Aquí está mi controlador:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
public class HomeController : Controller
{
    public ActionResult Index()
    {
        return View();
    }
 
    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> Index(EmailFormModel model, IEnumerable<HttpPostedFileBase> files)
    {
        if (ModelState.IsValid)
        {
            List<string> paths = new List<string>();
 
            foreach (var file in files)
            {
                if (file.ContentLength > 0)
                {
                    var fileName = Path.GetFileName(file.FileName);
                    var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
                    file.SaveAs(path);
                    paths.Add(path);
                }
            }
 
                var message = new MailMessage();
                foreach (var path in paths)
                {
                    var fileInfo = new FileInfo(path);
                    var memoryStream = new MemoryStream();
                    using (var stream = fileInfo.OpenRead())
                    {
                        stream.CopyTo(memoryStream);
                    }
                    memoryStream.Position = 0;
                    string fileName = fileInfo.Name;
                    message.Attachments.Add(new Attachment(memoryStream, fileName));
                }
 
                //Rest of business logic here
                string EncodedResponse = Request.Form["g-Recaptcha-Response"];
                bool IsCaptchaValid = (ReCaptcha.Validate(EncodedResponse) == "True" ? true : false);
                if (IsCaptchaValid)
                {
 
                    var body = "<p><b>Email From:</b> {0} ({1})</p><p><b>Subject:</b> {2} </p><p><b>Message:</b></p><p>{3}</p><p><b>Description:</b></p><p>{4}</p>";
                    message.To.Add(new MailAddress("***"));  // replace with valid value
                    message.From = new MailAddress("***");  // replace with valid value
                    message.Subject = "(Inquire)";
                    message.Body = string.Format(body, model.FromName, model.FromEmail, model.FromSubject, model.Message, model.Desc);
                    message.IsBodyHtml = true;
                    using (var smtp = new SmtpClient())
                    {
                        var credential = new NetworkCredential
                        {
                            UserName = "***",  // replace with valid value
                            Password = "***"  // replace with valid value
                        };
                        smtp.Credentials = credential;
                        smtp.Host = "smtp.live.com";
                        smtp.Port = 587;
                        smtp.EnableSsl = true;
                        smtp.SendCompleted += (s, e) =>
                        {
                            //delete attached files
                            foreach (var path in paths)
                                System.IO.File.Delete(path);
                        };
                        await smtp.SendMailAsync(message);
                        ViewBag.Message = "Your message has been sent!";
 
                        ModelState.Clear();
                        return View("Index");
                    }
                } else
 
                {
                    TempData["recaptcha"] = "Please verify that you are not a robot!";
                }
 
            } return View(model);
 
        }

Creo que el problema está en las rutas, pero no estoy muy seguro de cómo solucionarlo. Alguien me ayuda porfavor. Yo soy apenas nuevo con este tipo de materias. Gracias de antemano. Y también, cuando fue organizado el sitio web de la barra de navegación se convierte en azul, pero en el host local es negro. Y la imagen de fondo no aparece en el sitio web alojado. Por favor,
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder