I could find a solution by making a comment for authorization section of the web.config as follows:
1 <authentication mode="Forms">
2 <forms name=".ASPXUSERDEMO" loginUrl="login.aspx" protection="All"/>
3 </authentication>
4 <authorization >
5
6 </authorization>
It solved the problem and pages are redirected properly by response.redirect. Before I state the second problem, Could you please tell me whether it was an appropriate solution?.
Second Problem: I could send email based on the following code on local server.
MailMessage mailMSG = new MailMessage();
mailMSG.Body = "........";
mailMSG.To = "
[email protected]";
mailMSG.Subject = "Your Login details";
try
{
SmtpMail.Send(mailMSG);
}
catch (Exception ex)
{
Response.Write("Failure in sending email:" + ex.ToString());
return;
}
However, this code fails on main server (works on local server) and gives me the following error
"Failure in sending email:System.Web.HttpException: At least one of the From or Sender fields is required, and neither was found. ---> System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x8004020D): At least one of the From or Sender fields is required, and neither was found. --- End of inner exception stack trace --- at
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags,
Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Type.InvokeMember(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture) at System.Web.Mail.SmtpMail.LateBoundAccessHelper.Cal lMethod(Type type, Object obj, String methodName, Object[] args) at
System.Web.Mail.SmtpMail.LateBoundAccessHelper.Cal lMethod(Object obj, String methodName, Object[] args) --- End of inner exception stack trace --- at System.Web.Mail.SmtpMail.LateBoundAccessHelper.Cal lMethod(Object obj,
String methodName, Object[] args) at System.Web.Mail.SmtpMail.CdoSysHelper.Send(MailMes sage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at CCRD.LogIn.btnNewUser_Click(Object sender, EventArgs e) in C:\Documents
and Settings\bpazand\My Documents\Visual Studio 2008\Projects\CCRDDebug\CCRDDebug\LogIn.aspx.cs:li ne 47"
Could you please tell me why this error happens?