Learning ASP Series Your First ASP Page


ASP pages (Active Server Pages page sounds a bit melodramatic but
its easier to refer to them like this) are nothing but web pages.
The difference is that they have an extension.ASP and you write
the code in a Server Side Scripting language.

Do we know what's Server Side Scripting? This doesn't actually
matter if we delve into such nitty-gritty, but let's sound a bit
philosophically intellectual. Now, there are two sorts of
scripting languages:

Server Side (the hosting server where all the pages and programs
reside)

Client Side (the web surfer using the browser - actually the
browser is the client)

No, we are not talking about some corporate politics with all
this "siding" talk. Ok, before I begin with my bad sense of
humor, "Client Side Scripting" is what we generally see when we
code basic Java Scripts in our web pages to validate HTML forms
or implementing those cool image rollover effects or opening
custom popup windows etc. When you view the source of an HTML
page, and if the Java Script has been written in the page itself
(they have external Java Scripts too, but then that's a different
story), then you can see the script with all it's gory details. A
simple example of a Client Side Script written in Java Script is:



And then you can use it when the page loads:





A Server Side Script, on the other hand, does not manifest itself
when you try to use the "View Source" option of your browser. It
is a server side matter so unless you have the actual access to
the server, you cannot view the portion containing the server
side coding. But yes, the rest of the HTML matter is visible.

A typical ASP page looks like:

> Page Begins <

<%@LanguageVBScript%>
<% Option Explicit %>


<br/>< itle><br/></head><br/><body><br/><%<br/>Dim SayThis<br/>SayThis "Finally, I'm learning ASP!"<br/>Response.Write SayThis<br/>%><br/></body><br/></html><br/><br/>> Page Ends <<br/><br/>Provided you've configured your PWS in an amicable manner, this<br/>docile file should show up without fuss. You can copy/paste this<br/>page as it is using your preferred editor, and save the file as<br/>"basic.asp".<br/><br/>As you know, a basic HTML web page begins with the <html> tag,<br/>when you begin to work with an ASP page, try to make the first<br/>line as:<br/><br/><%@LanguageVBScript%><br/><% Option Explicit %><br/><br/>The first line tells the concerned authorities that the following<br/>code is going to contain VBScript syntax.<br/><br/>The second line forces us to declare every variable before we use<br/>it. We'll come back to this later when we are in a more aware<br/>state of mind.<br/><br/>My preferred script for ASP is VBScript, so most of my ponderings<br/>will be in this language. A few daredevils write their ASP pages<br/>in Perl too, but personally I feel it is an overkill and they are<br/>just trying to either show off or the features they want to use<br/>only exist in Perl. For that matter, even C++ is used for making<br/>ASP pages.<br/><br/>Anyway, done with the first line, are we?<br/><br/>As you can observe, we have all the quintessential HTML tags in<br/>an ASP page too, but they are only necessary if you intend to<br/>display the page to your visitors. If the page just includes a<br/>script that performs some programming function and then loads<br/>some other page, you can simply have the pure ASP code with first<br/>line as <% and the last line is %>.<br/><br/>> End of Chapter Two <<br/><br/>Note to the Reader: If you found this chapter useful, please let<br/>me know at mailto:amrit@bytesworth.com.<br/><p> About the Author <p>Amrit Hallan is a freelance web designer. For all web site<br/>development and web promotion needs, you can get in touch with<br/>him at http://www.bytesworth.com. For more such articles,<br/>visit http://www.bytesworth.com/articles and<br/>http://www.bytesworth.com/learn.</div><div class="panel panel-default" style="padding: 10px 10px 10px 10px;"><a class="btn btn-outline-primary btn-sm" href="/on/development/">development</a> <a class="btn btn-outline-primary btn-sm" href="/on/server/">server</a> <a class="btn btn-outline-primary btn-sm" href="/on/script/">script</a> <a class="btn btn-outline-primary btn-sm" href="/on/pages/">pages</a> <a class="btn btn-outline-primary btn-sm" href="/on/scripting/">scripting</a> <a class="btn btn-outline-primary btn-sm" href="/on/java/">java</a> <a class="btn btn-outline-primary btn-sm" href="/on/when/">when</a> </div> </div> </div> <!-- /#page-content-wrapper --> </div> <!-- /#wrapper --> <footer class="footer"> <div class="container-fluid text-right"> <p class="text-muted"><i class="fa fa-copyright" aria-hidden="true"></i> <a href="http://ondapc.com/" target="_blank">ondapc</a> project 2024</p> </div> </footer> <!-- CONTACT US --> <div class="modal" id="contact"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title"><i class="far fa-envelope"></i> Contact Me</h4> <button type="button" class="close" data-dismiss="modal"><i class="fa fa-times"></i></button> </div> <div class="modal-body"> <form id="contactar" name="contactar" method="post"> <input type="hidden" name="token" value="0f83b1a020207f39b769ed9fd1745124"> <input type="hidden" name="captcha" value=""> <div class="form-group"> <div class="input-group-prepend"> <span class="input-group-text"><i class="fas fa-user"></i></span> <input class="form-control" id="name" name="name" placeholder="Your Name" required="required" value="" type="text"> </div> </div> <div class="form-group"> <div class="input-group-prepend"> <span class="input-group-text"><i class="far fa-envelope"></i></span> <input class="form-control" id="email" name="email" placeholder="Email" required="required" value="" type="email"> </div> </div> <div class="form-group"> <div class="input-group-prepend"> <span class="input-group-text"><i class="fas fa-edit"></i></span> <textarea name="message" id="message" class="form-control" rows="9" cols="25" placeholder="Write a message" required="required"></textarea> </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-primary">Send <i class="fas fa-chevron-right"></i></button> </div> </div> </div> </div> <div id="contact" class="modal fade" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><i class="fa fa-times"></i></button> <h4 class="modal-title"><i class="fa fa-envelope-o"></i> Contact Me</h4> </div> <div class="modal-body"> </div> </div> </div> <script> $(function(){ $('#contactar').on('submit', function(e){ e.preventDefault(); $.ajax({ url: '/contactx/', type: 'POST', data: $('#contactar').serialize(), success: function(data){ $('#contactar')[0].reset(); $("#contact-success").append('<span><i class="fa fa-check"></i> Message Sent!</span>'); } }); }); }); </script> <!-- Bootstrap core JavaScript --> <script src="vendor/jquery/jquery.min.js"></script> <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> <!-- Menu Toggle Script --> <script> $("#menu-toggle").click(function(e) { e.preventDefault(); $("#wrapper").toggleClass("toggled"); }); </script> </body> </html> <!-- CACHE 2e7b86ee421379101715ef151d09928f 2024-04-27 11:18:33 -->