SQL PHP HTML ASP JavaScript articles and free scripts to download
 

Different requirement for redirecting users

We redirect the user to different pages or different site based on the condition or based on user selection. We may need different pages to be executed under different conditions. Some time visitor goes to different pages by clicking different links available on the page. But here we will learn how to redirect the user based on our program or our requirement. There can be many reasons to go for a redirection. Here are some of the common reasons for going for a redirection.

Server side form validation
We submit a form with data and we can design a server side form validation to check the user entered data. If the data entered by the user is not in required format or not as per standards then we may ask the visitor to feed the data again. So here we will send back the visitor to the same form page again showing the error message and asking the visitor to try again.

Sending users to different sections based on the permission level
In a portal we may have different areas marked for different types for users and we want the users to go directly to assigned area after they submit their identity ( may be by login ) . Here without any trigger from user end system will redirect the user to a page for there use.

End of a process.
Some time after submitting a data or after a forum posting you want the visitor to be redirected to display a Thank You message. We can have a common thank you page or an error page where we can redirect the browser.

We will discuss header redirection here. Read more on the same topic in PHP section header redirection.

Header Redirection precaution
One main care we have to take care before giving any header redirection is no data to be posted to the user browser before the header redirection command is applied. We can do our script processing and before sending any output to the browser we will redirect the user. Sometime we may not have any output intentionally posted before the redirection but under various condition some time error message the script will return, resulting in error message saying header already send.

Here is the common error message given by ASP engine if header is already sent and script example of header redirection using Response object.

Further readings
Configuring IIS to run website in local PC
ASP Introduction
ASP Installations
Basic File structure for simple ASP script
Advantage Disadvantage of ASP
Tasks ASP Can do
Buffer On or Off in ASP to control data flow to client browser
Different requirement for redirecting users
Response Object in header redirecting of browser
Escaping double quotes and printing to screen
 
Scripts
PHP
JavaScript
All ASP Tutorials
Popular Tutorials
Managing two drop downs
ASP Tutorials
Date and time
Declaring array
Form in ASP
Server.MapPath
Date Time & MSSQL
Select Query
File System Object
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.