Where to use ASP and where not to use ASP

A useful way to decide between Classic ASP and browser-side code is to ask where the information and authority live. ASP runs on the server during a request; JavaScript runs in the browser after the response reaches the user.

Use ASP for a server-side check

<%@ Language=VBScript %>
<%
Dim qty
qty = 3
If qty > 0 Then Response.Write "In stock"
%>

The result comes from server-side VBScript. For real inventory or authorization, retrieve trusted data on the server before evaluating a condition.

On this page — Show page sectionsHide page sections

Displaying an alert or reacting instantly to a click

That is a browser-side task, so use JavaScript. ASP can decide what HTML or JavaScript to send, but it cannot react to a later browser event unless the browser makes another request (for example through a form submission or AJAX).

Authenticating a user

Authentication and authorization decisions belong on the server. The browser can collect a user ID and password, but the server must verify the credentials and decide whether the user may access protected data. Client-side code must never be treated as the security boundary.

Validating form data

Use client-side validation to improve usability, but always validate important data again on the server. A visitor can disable or bypass browser JavaScript and can send requests directly to the server. See the client-side validation tutorial and the server-side regular-expression examples.

This server/client distinction becomes especially important in the database, login, session, and form-processing tutorials later in this section.

Choose the right execution environment

A browser can display a message immediately, but it cannot replace server-side authorization or database validation. A client-side check is not a security boundary.

Back to top ↑


ASP Home






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer