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

  • SEARCH
  • Home
  • 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 8084489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:49:07+00:00 2026-06-05T17:49:07+00:00

I have been attempting to use ASP.NET MVC remote validation for username login access

  • 0

I have been attempting to use ASP.NET MVC remote validation for username login access to return both a string and a boolean. If I return just a string, it will assume a boolean of false and not let the user submit the form. Is there a way I could pass in both true and a string such as “[USERNAME] is available!”?

Current method:

public JsonResult isUserAvailable(string username)
    {
        if (Membership.GetUser(username) == null)
        {
            return Json(String.Format(CultureInfo.InvariantCulture, "<strong style='color: green;'>{0} is available!</strong>", 
                username), JsonRequestBehavior.AllowGet);
        }

        else
        {
            return Json(false, JsonRequestBehavior.AllowGet);
        }
    }
  • 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-06-05T17:49:08+00:00Added an answer on June 5, 2026 at 5:49 pm

    As @Furqan suggested the data you are returning is not Json but Html.

    I suggest that you either return a Json object or a different ActionResult, perhaps ContentResult. This blog post does a good job of explaining the different ActionResult types.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been attempting to get log4net logging in my asp.net web application with
I have been attempting to have a object that I can use across multiple
I have been attempting to enhance my GUI system written in Java to use
I'm attempting to eliminate the duplication accross two ASP.NET web projects that use exactly
I have been attempting to enhance my GUI system written in Java to use
I have been attempting to use an android.preference.DialogPreference inflated from XML, but the documentation
I have been attempting to use the command line tool crmsvcutil (as Administrator) to
I have been having trouble while attempting to use the nextLine() method from java.util.Scanner.
I have been attempting to use OpenGL with C++ lately and I have come
I've been attempting to create a resizable textbox (ASP.NET multiline TextBox / HTML textarea

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.