I need to validate textbox so that it can only take website url up-to domain code only.
For e.g. User must insert website url as "http://www.google.com".
If user insert "http://www.codeproject.com/Articles/334310/Understanding-ASP-NET-Validation-Techniques" then it should not allow.
Allowed:-"http://www.google.com"
Not Allowed:-"http://www.codeproject.com/Articles/334310/Understanding-ASP-NET-Validation-Techniques"
Please help.

Rajeesh MenothRank #118 · 18.4K reputationPosted Sep 11, 2015, 8:22 AM EDT
// Verify that this is an allowed web site. private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) { if (e.Url.Host != "www.csharphelper.com") { e.Cancel = true; MessageBox.Show("This web site is prohibited", "Prohibited", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }