Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3606602
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:16:11+00:00 2026-05-18T21:16:11+00:00

I have a couple things going on right now. I have a form that

  • 0

I have a couple things going on right now. I have a form that I am trying to do client side validation on, and it is working however, if I click submit with one of the fields not being valid, it will still send the information to the client which I don’t want to do until all of the information is correct.

The other problem I am having is I keep getting a “http-status code 500” when I click the submit button, and the form will still work and send out email even though I am getting this 500 error(using fiddler2 it shows this, otherwise I wouldn’t know). Can anyone please tell me why this is, and how I can remedy it please. Thank you guys.

Here is my form:

<div id="Contact">
<% Html.EnableClientValidation(); %>
<%using (Html.BeginForm("SendContactMessage", "ContactUs", FormMethod.Post))
{%>

<table cellpadding="0" cellspacing="0" border="0" width="900" height="100%"> 
<tr> 
<td id="body" class="Content"> 
<table cellpadding="0" cellspacing="0" border="0"> 
<tr> 
<td align="right" valign="middle"> 
<label for="name" id="name">First & Last Name</label><br> 
<label class="req">
            <%=Html.ValidationMessageFor(a => a.ContactName)%>
            Required</label> 
</td> 
<td class="fieldareacontact"> 
<%= Html.TextBox("ContactName", Model.ContactName, new { id = "Name", title = "name", @class = "fieldscontact" })%>
</td> 
</tr> 
<tr> 
<td align="right" valign="middle"> 
<label>Email Address</label><br> 
<label class="req">
            <%=Html.ValidationMessageFor(a => a.ContactEmail)%>
            Required
            </label> 
</td> 
<td class="fieldareacontact"> 
            <%= Html.TextBox("ContactEmail", Model.ContactEmail, new { id = "Email", title = "email", @class = "fieldscontact" })%>
</td> 
</tr> 
<tr> 
<td align="right" valign="top" style="padding-top: 15px"> 
<label>Whatcha' Got?</label> 
</td> 
<td class="fieldareacontact">
            <%= Html.TextArea("ContactCommentsOrQuestions", Model.ContactCommentsOrQuestions, new { Style = "width: 260px; height:150px", id = "CommentsOrQuestions", title = "comments", @class = "fieldscontact" })%> 
</td> 
            <%= Html.ValidationMessage("Contacterror")%>
            <% if (!ViewData.ModelState.IsValid)
                {%><br /><%} %>    
</tr> 

<tr> 
<td align="right" valign="top" style="padding-top: 15px"> 

</td> 
<td align="right" valign="top" style="padding-top: 15px"> 
<input type="submit" id="submit" value="Submit" class="button" /> 
</td> 
</tr> 
</table> 
    <%} %>
    </div>

Here are a couple of my controllers:

public ActionResult Index()
    {
        ContactUsViewModel model = new ContactUsViewModel();
        return View(model);
    }

    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult SendContactMessage(ContactUsViewModel model)
    {

        if (this.ModelState.IsValid)
        {
            try
            {
                // get contact configuration
                DoSendMessage(model);
                //return View(model);
                return View(new ContactUsViewModel());
            }
            catch (Exception ex)
            {
                //TODO: log/notify error

                //while( ex != null ){
                //Response.Write( "<HR>" + ex.ToString() );
                //ex = ex.InnerException;
                //}

                ModelState.AddModelError("Contacterror", "An unexpected error occured, please contact the webmaster.");
                return View();
            }
        }
        else
        {
            ModelState.AddModelError("Contacterror", "Please correct the above with a \"*\".");
            return View(model);
        }
    }

The DoSendMessage() just sends the email notifications, and I know that function works, since even with the 500 error, I still can somehow get emails.

Here is the 500 error:

Server Error in ‘/’ Application.

The view ‘SendContactMessage’ or its master was not found. The following locations were searched:

~/Views/ContactUs/SendContactMessage.aspx

~/Views/ContactUs/SendContactMessage.ascx

~/Views/Shared/SendContactMessage.aspx

~/Views/Shared/SendContactMessage.ascx

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.InvalidOperationException: The view ‘SendContactMessage’ or its master was not found. The following locations were searched:

~/Views/ContactUs/SendContactMessage.aspx

~/Views/ContactUs/SendContactMessage.ascx

~/Views/Shared/SendContactMessage.aspx

~/Views/Shared/SendContactMessage.ascx

Why is it looking for a page, when I’m calling a method? Please help, and thank you all in advance, I’m sorry if this is a novice question, but I wasn’t able to find more resources on why I am having these errors.

Here is the DataAnnotation:

public class ContactUsViewModel
{
    [Required(ErrorMessage = "*")]
    public string ContactName { get; set; }

    [Required(ErrorMessage = "*")]
    //this is my own regular expression that I created
    [RegularExpression("^[a-zA-Z0-9]+[\\.a-zA-Z0-9_]*[@][.a-zA-Z0-9]+[.]([a-z]{2,4})$", ErrorMessage = "*")]
    public string ContactEmail { get; set; }

    //[Required(ErrorMessage = "*")]
    public string ContactCommentsOrQuestions { get; set; }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:16:12+00:00Added an answer on May 18, 2026 at 9:16 pm

    Modify your else statement:

        else
        {
            ModelState.AddModelError("Contacterror", "Please correct the above with a \"*\".");
            return View("Index", model);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a couple old services that I want to completely uninstall. How can
I have a couple of triggers on a table that I want to keep
We have a couple of applications running on Java 5 and would like now
I am just learning how to write mutithreaded programs right now and I have
I'll have couple of python functions I must interface with from the assembly code.
I have a couple of questions regarding VBScript and ASP Classic: What is the
I have a couple of files containing a value in each line. EDIT :
We have a couple of mirrored SQL Server databases. My first problem - the
We have a couple of developers asking for allow_url_fopen to be enabled on our
I have a couple of header files, which boil down to: tree.h: #include element.h

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.