How to validate open id text box as that of stackoverflow i am using dotnet open id
what i have done is
<asp:CustomValidator runat="server" ID="openidValidator" ErrorMessage="Invalid OpenID Identifier"
ControlToValidate="txtOpenId" EnableViewState="false" OnServerValidate="openidValidator_ServerValidate"
ValidationGroup="validateOpenID" />
in the code behind
protected void openidValidator_ServerValidate(object source, ServerValidateEventArgs args)
{
// This catches common typos that result in an invalid OpenID Identifier.
args.IsValid = Identifier.IsValid(args.Value);
}
but it is not validating it in all cases
There are two steps to validating an OpenID identifier. One is just validating its form without any network access. And
Identifier.IsValiddoes this. Yes, a single letter is actually a valid OpenID “user-supplied identifier”. It could be an OpenID identifier hosted by another computer on your local network. It’s impossible to know for sure unless you actually take the next step, which isOpenIdRelyingParty.CreateRequestand see if it fails.StackOverflow takes some additional validation steps by looking at what likely identifiers will be and writing custom rules that reject identifiers that don’t look like likely real identifier (although technically they could be). There is no comprehensive list of what these are as far as I know so you’ll have to write your own logic if you want additional validation. Just err on the side of allowing identifiers since if you’re too selective on the input you select you might tick off some users.