Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery Username Validation with asp.net
    text
    copied!<p>I am using the best tutorial of encosia website which was written by David ward and by his example given in his website for instant validation of username.</p> <p>Here is the link of the original post: <a href="http://encosia.com/aspnet-username-availability-checking-via-ajax/" rel="nofollow">http://encosia.com/aspnet-username-availability-checking-via-ajax/</a></p> <p>So the problem here with this code is though I am using my custom membership it is always showing me the user is "<code>Available</code>" instead of "<code>Not Available</code>" if the user is not in the database.</p> <p>Here is my code:</p> <pre><code> protected void Username_Changed(object sender, EventArgs e) { System.Threading.Thread.Sleep(2000); if (Membership.GetUser(Username.Text) != null) { UserAvailability.InnerText = "Username taken, sorry."; UserAvailability.Attributes.Add("class", "taken"); Button1.Enabled = false; } else { UserAvailability.InnerText = "Username available!"; UserAvailability.Attributes.Add("class", "available"); Button1.Enabled = true; } } </code></pre> <p>This is my web.config:</p> <pre><code> &lt;connectionStrings&gt; &lt;remove name="LocalSqlServer"/&gt; &lt;add name="LocalSqlServer" connectionString="Data Source=.\sqlexpress;Initial Catalog=CustomMembership;Integrated Security=True" providerName="System.Data.SqlClient"/&gt; &lt;/connectionStrings&gt; &lt;membership defaultProvider="CustomMembership"&gt; &lt;providers&gt; &lt;add name="CustomMembership" connectionStringName="LocalSqlServer" enablePasswordReset="true" enablePasswordRetrieval="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordAttemptWindow="5" passwordStrengthRegularExpression="" type="System.Web.Security.SqlMembershipProvider" /&gt; &lt;/providers&gt; &lt;/membership&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload