CL1 webserver: <Anantsystems<Ad info>

    AspnetEmail.com   AspNetPro.com

related sites: <FREE Help> <ASP> <Asp.net> <worldwide>  
feedback: <lovethat> <hatethat> <thanks> <credits> <contact us>

advice: Encode with Redirects
Lessons: New  Changed  Beginners
<Table of Contents> <Print, More Options>
<E-Mail To Friend> CL1
<Previous> advice:Option Explicit

advice: Write Your SQL <Next>

Alphabetical Index: A | B | C | D | E | F | G | H | I | J | L | M | N | O | P | Q | R | S | T | U | V | W | X | 

       

ASP Commandment #2: Encode!

When dynamically building a URL with your code, the URL may work fine in IE but Netscape presents this ERROR message:

HTTP Error 400

400 Bad Request

Due to malformed syntax, the request could not be understood by the server.
The client should not repeat the request without modifications.

Use Server.URLEncode when passing parameters so that characters within the data are encoded properly (spaces replaced with "+", etc.).

This is bad:
<%
URL="wherever.asp"
part1="fname=Joe"
part2="&company=Bait Shop"
part3="&fax=703-277-2233"
response.redirect URL & "?" & part1 & part2 & part3

%>

This is good:
<%
URL="wherever.asp"
part1="fname=" & server.URLencode("Joe")
part2="&company=" & server.URLencode("Bait Shop")
part3="&fax=" & server.URLencode("703-277-2233")
response.redirect URL & "?" & part1 & part2 & part3

%>

advice: Encode with Redirects
Lessons: New  Changed  Beginners
<Table of Contents> <Print, More Options>
<E-Mail To Friend>
<Previous> advice:Option Explicit

advice: Write Your SQL <Next>

CL1 webserver: <Anantsystems<Ad info>

    AspnetEmail.com   AspNetPro.com

related sites: <FREE Help> <ASP> <Asp.net> <worldwide>  
feedback: <lovethat> <hatethat> <thanks> <credits> <contact us>