Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validating email address?
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01540791
Message ID:
01540799
Views:
40
>>>>Is it possible to validate email address such that only emails that have a certain domain are allowed. For example, that only "yahoo.com" emails are allowed. (e.g. name@yahoo.com, name2@yahoo.com). But emails like name@msn.com are rejected? TIA.
>>>
>>>If it is inside your application, just parsing would do it. You may enter a list of domains and filter them out, or in your case, validate them against your validation rules.
>>
>>Yes, this is within my application. Doing it "in code" my approach too. I just thought that maybe .NET already has a class that does it.
>
>I've a feeling that you're requirements may not be as simple as they sound (if so pls enlarge) but:
string address = "fred@google.com";
>string domain = "@GOOGLE.COM";
>bool isValid = address.EndsWith(domain.ToUpper());
better uppercase the address..

address.ToUpper().EndsWith(domain.ToUpper())
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform