Έγραψα τον εξής κώδικα για να στέλνω mail από μία φόρμα:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-7" %>
<%@ Import Namespace="System.Web.Mail" %>
...
<script runat="server">
void btnSubmit_Click(Object sender, EventArgs e) {
MailMessage objEmail = new MailMessage();
objEmail.To = "[email protected]"
objEmail.From = txtFrom.Text;
objEmail.Subject = "Μήνυμα από την φόρμα Επικοινωνίας";
objEmail.Body = txtName.Text + ", Τηλέφωνο: " + txtPhone.Text +"\n ", email: " + txtFrom.Text + " : " + txtComments.Text;
objEmail.Priority = MailPriority.High;
objEmail.BodyFormat = MailFormat.Html;
SmtpMail.SmtpServer = "localhost";
try{
SmtpMail.Send(objEmail);
txtMessage.Text="Ευχαριστούμε για την παρατήρησή σας";
txtName.Text="";
txtFrom.Text="";
txtPhone.Text="";
txtComments.Text="";
}
catch (Exception exc){
txtMessage.Text="Αποτυχία αποστολής: " + exc.ToString();
}
}
</script>, ο οποίος λειτουργεί κανονικά σε μένα που βάζω το smtp του παροχέα μου για να στέλνει τα mail αλλά στο hosting που έχω βάλει localhost μου βγάζει το εξής η εφαρμογή:
Server Error in '/' Application.
Unable to validate data.
Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.
Exception Details: System.Web.HttpException: Unable to validate data.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
|
Stack Trace:
[HttpException (0x80004005): Unable to validate data.] System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +196 System.Web.UI.LosFormatter.Deserialize(String input) +60
[HttpException (0x80004005): Authentication of viewstate failed. 1) If this is a cluster, edit <machineKey> configuration so all servers use the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 2) Viewstate can only be posted back to the same page. 3) The viewstate for this page might be corrupted.] System.Web.UI.LosFormatter.Deserialize(String input) +118 System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +102
[HttpException (0x80004005): Invalid_Viewstate Client IP: 193.92.136.93 Port: 3907 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; el; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 ViewState: dDwtMTA3MjQ4NzkwNzs7Pr0SIwTwykBmeE36gkwOZ+tYiXEv Http-Referer: http://www.fiberfun.com.gr/contact.aspx Path: /contact.aspx.] System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +448 System.Web.UI.Page.LoadPageViewState() +18 System.Web.UI.Page.ProcessRequestMain() +447
|
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300Έχετε καμία ιδέα τι φταίει που δεν μπορεί να κάνει validation?