background preloader

HTTP Modules

Facebook Twitter

301 Redirect - How to create Redirects. 301 Redirect 301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It's not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it's the safest option. The code "301" is interpreted as "moved permanently". You can Test your redirection with Search Engine Friendly Redirect Checker Below are a Couple of methods to implement URL Redirection via code and htaccess redirect IIS Redirect In internet services manager, right click on the file or folder you wish to redirect Select the radio titled "a redirection to a URL". ColdFusion Redirect PHP Redirect ASP Redirect ASP .NET Redirect JSP (Java) Redirect CGI PERL Redirect $q = new CGI; print $q->redirect(" Ruby on Rails Redirect def old_action headers["Status"] = "301 Moved Permanently" redirect_to " end Redirect Old domain to New domain using htaccess redirect.

C# code to add a custom HTTP Header : http. IntelliTechture. Calling web services using basic authentication I recently made a web services call into WebMethods using basic authentication. This authentication meant that we needed to modify the WSDL generated classes to handle the authentication. Here’s how it works. I add a reference to the Web Service (Visual Studio generates the client code for calling the web service). To this generated class I need to add the following method: This overrides the GetWebRequest() method of the System.Web.Services.Protocols.SoapHttpClientProtocol class that the web service client code derived from. With Visual Studio 2005 the generated code code is a C# 2.0 partial classes. Regardless of using Visual Studio.NET 2005 or earlier, the client code requires that the network credentials are set and the PreAuthenticate property is assigned true.

Comments on the post raised the question, “Why cant you just say request.Credentials = new NetworkCredential(username,password).” The reply back from WebMethods is as follows: How to add custom Http Header for C# Web Service Client consuming Axis 1.4 Web service. HttpWebRequest.Headers Property (System.Net) Specifies a collection of the name/value pairs that make up the HTTP headers. public override WebHeaderCollection Headers { get; set; } The Headers collection contains the protocol headers associated with the request. The following table lists the HTTP headers that are not stored in the Headers collection but are either set by the system or set by properties or methods. You should not assume that the header values will remain unchanged, because Web servers and caches may change or add headers to a Web request.

The following code example uses the Headers property to print the HTTP header name/value pairs to the console. .NET Framework Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client Profile Supported in: 4, 3.5 SP1 Portable Class Library Supported in: Portable Class Library .NET for Windows Store apps Supported in: Windows 8 .NET for Windows Phone apps Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1.