Learning ASP Series -- Your First ASP Page

Written by Amrit Hallan


Continued from page 1

==> Page Begins <==

<%@Language=VBScript%> <% Option Explicit %> < itle> </head> <body> <% Dim SayThis SayThis = "Finally, I'm learning ASP!" Response.Write SayThis %> </body> </html><p>==> Page Ends <==<p>Provided you've configured your PWS in an amicable manner, this docile file should show up without fuss. You can copy/paste this page as it is using your preferred editor, and save<IMG height=12 src="/the2.jpg" alt="repparttar "> file as "basic.asp".<p>As you know, a basic HTML web page begins with<IMG height=12 src="/the2.jpg" alt="repparttar 131919"> <html> tag, when you begin to work with an ASP page, try to make<IMG height=12 src="/the2.jpg" alt="repparttar 131920"> first line as:<p><%@Language=VBScript%> <% Option Explicit %><p>The first line tells<IMG height=12 src="/the2.jpg" alt="repparttar 131921"> concerned authorities that<IMG height=12 src="/the2.jpg" alt="repparttar 131922"> following code is going to contain VBScript syntax.<p>The second line forces us to declare every variable before we use it. We'll come back to this later when we are in a more aware state of mind.<p>My preferred script for ASP is VBScript, so most of my ponderings will be in this language. A few daredevils write their ASP pages in Perl too, but personally I feel it is an overkill and they are just trying to either show off or<IMG height=12 src="/the2.jpg" alt="repparttar 131923"> features they want to use only exist in Perl. For that matter, even C++ is used for making ASP pages.<p>Anyway, done with<IMG height=12 src="/the2.jpg" alt="repparttar 131924"> first line, are we?<p>As you can observe, we have all<IMG height=12 src="/the2.jpg" alt="repparttar 131925"> quintessential HTML tags in an ASP page too, but they are only necessary if you intend to display<IMG height=12 src="/the2.jpg" alt="repparttar 131926"> page to your visitors. If<IMG height=12 src="/the2.jpg" alt="repparttar 131927"> page just includes a script that performs some programming function and then loads some other page, you can simply have<IMG height=12 src="/the2.jpg" alt="repparttar 131928"> pure ASP code with first line as <% and<IMG height=12 src="/the2.jpg" alt="repparttar 131929"> last line is %>.<p>==> End of Chapter Two <==<p>Note to<IMG height=12 src="/the2.jpg" alt="repparttar 131930"> Reader: If you found this chapter useful, please let me know at mailto:amrit@bytesworth.com. <br><img src="images/ata.gif"><br> <p>Amrit Hallan is a freelance web designer. For all web site development and web promotion needs, you can get in touch with him at http://www.bytesworth.com. For more such articles, visit http://www.bytesworth.com/articles and http://www.bytesworth.com/learn.<br><br><br></font></td><!-- google_ad_section_end --><!-- google_ad_section_start(weight=ignore) --><td align="top" width="10%"></td><td align="top" width="45%"><h2>Learning ASP Series - Installing Personal Web Server</h2><font size="2">Written by Amrit Hallan</font><br><br><script type="text/javascript"><!-- google_ad_client = "pub-5766870852072819"; google_ad_width = 234; google_ad_height = 60; google_ad_format = "234x60_as"; google_ad_channel ="9238851329"; google_color_border = "CFB9A1"; google_color_bg = "CFB9A1"; google_color_link = "000000"; google_color_url = "431B02"; google_color_text = "431B02"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <font size="2"><br>Continued from page 1<br><p>C:INETPUBWWWROOTBYTESWORTH<p>And when I have to view<IMG height=12 src="/the2.jpg" alt="repparttar "> page on my browser, I'll have to type<p>http://localhost/bytesworth<p>as<IMG height=12 src="/the2.jpg" alt="repparttar 131917"> URL.<p>After you've installed<IMG height=12 src="/the2.jpg" alt="repparttar 131918"> PWS, it's icon appears on your desktop, and at<IMG height=12 src="/the2.jpg" alt="repparttar 131919"> bottom right of your screen. Click or double-click on<IMG height=12 src="/the2.jpg" alt="repparttar 131920"> icon. On<IMG height=12 src="/the2.jpg" alt="repparttar 131921"> main window, you should see<IMG height=12 src="/the2.jpg" alt="repparttar 131922"> message:<p>Web publishing is on. Your Home page is available at http://servername<p>The servername is<IMG height=12 src="/the2.jpg" alt="repparttar 131923"> name you use instead of localhost. But if you are confused about this name game, just use localhost and it should always work if you haven't been naughty and messing around with your computer's basic setup.<p>Before you proceed further, open<IMG height=12 src="/the2.jpg" alt="repparttar 131924"> Windows Explorer, go to c:inetpubwwwroot and create a new folder here by<IMG height=12 src="/the2.jpg" alt="repparttar 131925"> name of "learnASP" (how boringly predictable! So you can name it something else). We'll be storing ALL our files in this folder.<p>Hence, whenever we want to run a newly created file, we'd type in<IMG height=12 src="/the2.jpg" alt="repparttar 131926"> location bar:<p>http://localhost/learnASP/newfile.asp and press Enter.<p>Ok, next, click on<IMG height=12 src="/the2.jpg" alt="repparttar 131927"> Advanced tab. Select Enable Default Document<p>In<IMG height=12 src="/the2.jpg" alt="repparttar 131928"> Default Document(s) box, type<IMG height=12 src="/the2.jpg" alt="repparttar 131929"> list of file names you would like to use as your default file once<IMG height=12 src="/the2.jpg" alt="repparttar 131930"> name of your site is type in<IMG height=12 src="/the2.jpg" alt="repparttar 131931"> browser.<p>If you have no idea what's<IMG height=12 src="/the2.jpg" alt="repparttar 131932"> default file, it is<IMG height=12 src="/the2.jpg" alt="repparttar 131933"> file that answers your call when you type a specific URL without a specific file. For instance, if I type http://www.bytesworth.com<IMG height=12 src="/the2.jpg" alt="repparttar 131934"> file that actually gets loaded by default is DEFAULT.ASP. This depends on<IMG height=12 src="/the2.jpg" alt="repparttar 131935"> setting. Some servers use INDEX.ASP or INDEX.HTML or INDEX.SHTML. It all depends on<IMG height=12 src="/the2.jpg" alt="repparttar 131936"> file parsing set up on your web-hosting server.<p>Then click on<IMG height=12 src="/the2.jpg" alt="repparttar 131937"> Edit Properties button, after selecting<IMG height=12 src="/the2.jpg" alt="repparttar 131938"> Home folder. There are three select boxes, viz., "Read", "Execute", "Script". Select all of them. The selections tell<IMG height=12 src="/the2.jpg" alt="repparttar 131939"> server that we want to execute server side scripts in our ASP pages. ASP pages won't run if<IMG height=12 src="/the2.jpg" alt="repparttar 131940"> server can't read and execute them.<p>Close<IMG height=12 src="/the2.jpg" alt="repparttar 131941"> window, and your PWS is running. Of course do not run two servers simultaneously. So if you installed<IMG height=12 src="/the2.jpg" alt="repparttar 131942"> Apache Web Server and left it running, and then loaded PWS, there is going to be some problem for you to sort out. <br><img src="images/ata.gif"><br> <p>Amrit Hallan is a freelance web designer. For all web site development and web promotion needs, you can get in touch with him at http://www.bytesworth.com. For more such articles, visit http://www.bytesworth.com/articles and http://www.bytesworth.com/learn.<br><br><br></font></td><!-- google_ad_section_end --></tr><tr><td>    <a class="mlink" href="Learning_ASP_Series_--_Your_First_ASP_Page-31919.htm"><</a>Back to Page 1</td></tr></table><script type="text/javascript"><!-- google_ad_client = "pub-5766870852072819"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_channel ="8831454965"; google_color_border = "CFB9A1"; google_color_bg = "CFB9A1"; google_color_link = "000000"; google_color_url = "431B02"; google_color_text = "431B02"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </td> </tr> </table> <table width="770" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> <tr> <td height="48" align="center" background="images/bg_nav_bottm.jpg"><span class="style3">ImproveHomeLife.com © 2005<br> <a href="terms.html" rel="nofollow">Terms of Use</a></span></td> </tr> </table></td> </tr> </table> <script type="text/javascript"> var HASH_ESCAPED="%23"; function TrackIt(adUnit){ if (window.status) { var adDomain = escape(window.status.substring(6)); var pyPage = document.location.pathname; var params = document.location.search; var hasAnchor = params.lastIndexOf(HASH_ESCAPED)!= -1; params = hasAnchor? (params.substring(0, params.lastIndexOf(HASH_ESCAPED))) : params; pyPage = escape(pyPage.substring(pyPage.lastIndexOf('/') + 1)); pyPage = pyPage + params; var curTime = new Date().valueOf(); var bug = new Image(); bug.src = '/track/adsenseTrack.php?pyPage=' + pyPage + '&adDomain=' + adDomain + '&adUnit=' + adUnit + "&time=" + curTime; } } function TrackIt0() {TrackIt(0); } function TrackIt1() {TrackIt(1); } function TrackIt2() {TrackIt(2); } var elements = document.getElementsByTagName("iframe"); for (var i = 0; i < elements.length; i++) { if(elements[i].src.indexOf('googlesyndication.com') > -1) { //elements[i].onfocus = TrackIt; if (i==0) elements[i].onfocus = TrackIt0; if (i==1) elements[i].onfocus = TrackIt1; if (i==2) elements[i].onfocus = TrackIt2; } } </script> <!--WEBBOT bot="HTMLMarkup" startspan ALT="Site Meter" --> <script type="text/javascript" language="JavaScript">var site="s19improve"</script> <script type="text/javascript" language="JavaScript1.2" src="http://s19.sitemeter.com/js/counter.js?site=s19improve"> </script> <noscript> <a href="http://s19.sitemeter.com/stats.asp?site=s19improve" target="_top"> <img src="http://s19.sitemeter.com/meter.asp?site=s19improve" alt="Site Meter" border=0></a> </noscript> <!-- Copyright (c)2002 Site Meter --> <!--WEBBOT bot="HTMLMarkup" Endspan --> </body> </html>