Friday, May 30, 2008

Regular Expression that accepts 0-9,space,/,+,- only

^([0-9][\ ][\/][\+][\-])*$

The below link can be used to test your regular expressions:
http://www.dotnetcoders.com/web/Learning/Regex/RegexTester.aspx

Calling a web-service

Here I am not concerned about creating a web-service & consuming it. I hope you know this already. But sometimes when you consume the web-service in .NET it throws an exception like 'The request failed with HTTP status 401 : unauthorized'. When you try to run the web-service directly, it runs without fail.


Resolution:

Dim obj As New basicops.operations
obj.Credentials = System.Net.CredentialCache.DefaultCredentials

lblResult.Text = "Result: " & obj.Subtract(Convert.ToInt32(TextBox1.Text), Convert.ToInt32(TextBox2.Text)).ToString()