Home » Posts tagged "redirect"

Archive for the 'redirect' Tag

HTTP – HTTPS Redirect

VB code If Not Request.IsLocal AndAlso Not Request.IsSecureConnection Then Dim redirectUrl As String = Request.Url.ToString().Replace(“http:”, “https:”) Response.Redirect(redirectUrl) End If C# code if (!Request.IsLocal && !Request.IsSecureConnection) { string redirectUrl = Request.Url.ToString().Replace(“http:”, “https:”); Response.Redirect(redirectUrl); } Classic asp Read more… ‘do https stuff dim httpsStuff httpsStuff = Request.ServerVariables(“PATH_INFO”) if Request.ServerVariables(“QUERY_STRING”) “” then httpsStuff = httpsStuff & “?” & […]

Drop-down onChange event

Chose file type: <select onChange=”window.location=this.options[this.selectedIndex].value;”> <option selected>Please select</option> <option value=”Music.aspx”>Music Files</option> <option value=”Movie.aspx”>Movies</option> <option value=”OfficeDoc.aspx#word”>Word Files</option> </select> EXAMPLE: Chose file type: Please select…Music FilesMoviesWord Files

Page Redirect

HTML <meta http-equiv=”refresh” content=”0;url=http://google.com”> Javascript <script language=”javascript”> <!– location.replace(“http://google.com”) //–> </script> Asp / ASP.Net <% Request.Redirect(“http://google.com”) %> Php <?php header( ‘Location: http://google.com’ ) ; ?> Perl (method 1) #!/usr/bin/perl use strict; use warnings; my $url = “http://google.com”; print “Location: $url\n\n”; (method 2) #!/usr/bin/perl print “Content-Type: text/html\n”; print “Location: http://google.com\n\n”; (method 3 – using CGI module) […]