Accessing web service from behind proxy 06 November 2005 (0) If you are going to (via a proxy server) connect to a web service on the Internet you may need to do the following (VB.NET): Dim s As Service1 s = New Service1 s.Credentials = System.Net.CredentialCache.DefaultCredentials s.Proxy = New System.Net.WebProxy(”internal proxy server address”, 80) s.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials SHARE:
Generating truly random numbers with multiple simultaneous request 04 November 2005 (0) The Random Class, given a constant seed will always generate the samesequence of numbers.Creating a Random object using the default constructor uses the current timeas the seed, so if you have multiple simultaneous requests and need to getdifferent numbers this approach will not work.A slightly cumbersome “fix” to generate a seed is shown below. Thisessential [...] SHARE:
The request failed with HTTP status 401: Unauthorized 01 September 2005 (0) If you are using IIS 6.0 and your application is using an Application Pool with an Identity set to a domain account you may get: The request failed with HTTP status 401: Unauthorized Check out this msdn article for a workaround. SHARE:
ASP.NET CustomValidator doesn’t fire ServerValidate event w hen input box is empty 01 September 2005 (0) ASP.NET valuator controls don’t validate empty input by default, this iswhat the RequiredFieldValidator is for… sometimes for customised inputvalidation you might not want this behaviour (e.g. if one of two input boxesmust be non-blank)… /// /// Overrides the default behaviour of CustomValidator to allow /// ServerValidate event to fire even if the input is blank./// public [...] SHARE:
Using network load balancing (NLB) with transactional MSMQ message 01 September 2005 (0) Want to send transactional messages using DIRECT format TCP to multiple server through a network load balancer? You can’t. Simple as that. See MSDN article ID 899611 Essentially you could have a single message delivered to more than one server which could be very bad news if they contain something like a “transfer money” message… From [...] SHARE:
location.replace doesn’t work when the following page is a PDF 25 August 2005 (0) Applies to:IE 6.0 (+others?), ASP.NET 1.1, JavaScript, PDF, Adobe Acrobat For some reason (at least in IE 6.0) if you use location.replace (to’disable’ back button by changing browser history) doesn’t work when thenext page is a dynamically displayed PDF, e.g. Response.ContentType=”application/pdf”;Response.BinaryWrite( (byte[]) Session[myPDF]);Response.Flush(); The history still displays the prior page in the history list. I’m not sure if [...] SHARE:
Using client certification authentication in web services in .NET 24 August 2005 (0) Applies to.NET 1.1IIS 6Windows 2003 ServerWindows XP (as client) 1. Obtain trial SSL server certificate (e.g. from Verisign) and install to IIS 6;2. On client machine, obtain personal “client” certificate (sometimes called email certificate) (e.g. from verisign);3. Using the certificates (Current User) MMC snapin, navigate to the Personal – Certificates folder (you should see your certificate [...] SHARE:
Checking if a given Type implements a specific interface 17 August 2005 (0) There is possibly a framework method to do this but… private bool IsInterfaceImplemented(Type typeToCheck, Type interfaceToFind){Type[] interfaces = typeToCheck.GetInterfaces();foreach (Type iface in interfaces){if (iface == interfaceToFind){return true;}}return false;} SHARE:
Nunit GUI quits without exception when testing objects derived from ServicedComponent 12 August 2005 (0) This is apparently a known issue… If you have problems using NUnit with EnterpriseServices, use the command line runner, nunit-console.exe (you will have to append your path to point to it eg. set path=%path%;C:\Program Files\NUnit V2.1\bin {assuming default install path}). SHARE:
Regular Expression library 21 April 2005 (0) For a library of pre defined regular expressions, check out www.regexlib.com. SHARE: