ASP
  Home arrow ASP arrow Client-side ASP scripting with HTML Script...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP

Client-side ASP scripting with HTML Scripting Pages
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 10
    2003-01-01

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Active Server Pages (ASP) is a well known server side scripting technology. We will explain how this web technology can be emulated entirely on aWindows client machine from within Internet Explorer (IE) and Internet Explorer ActiveXwebbrowser controls (IEX controls)  using custom IE pluggable protocolsand Windows Scripting to turn IE into an interactive programmingenvironment.  We will also examine how we can use content storage files Active Server Pages (ASP) is a well known server side scripting technology. We will explain how this web technology can be emulated entirely on aWindows client machine from within Internet Explorer (IE) and Internet Explorer ActiveXwebbrowser controls (IEX controls)  using custom IE pluggable protocolsand Windows Scripting to turn IE into an interactive programmingenvironment.  We will also examine how we can use content storage files tostore all HTML/ASP/graphic files in a single file to be read by the pluggableprotocol.

    The use of embedded Internet Explorer ActiveX controls (orIEX for short) can enhance Windows programs very powerfully.  The ability to easily add multi-media content to your Windows programs is quite compelling.  Trying to place graphics and tabular data using C++ or even VB is quite a bit of effort.  There are many issues with placement, resizing and a range of other messy problems.  Using the IEX webbrowser control to easily display HTML contentcan be quite compelling.  Furthermore, HTML content can bechanged without recompiling your program. This can be quite advantageous indeed.  Microsoft uses IEX with HTML content in limited amounts in products and tools such asOutlook (and Express), and MMC.  

    One of the major drawbacks to using embedded web browsercontrols is that they can only display static content.  That is, untilnow.  HTML Scripting Pages, or HSP for short, is the first and onlyproduct to actually run ASP pages on the Windows client machine in a plug-in DLL. No longer are webpages doomed to only display static webpages.  With HSP,webpages can be seamlessly generated on the fly within either theInternet Explorer webbrowser or embedded IEX webbrowser controls.  You canactually run "browser applications" (analogous to a web application)right inside Internet Explorer entirely on the Windows machine with no Internetconnection.  This ability has tremendous implications for Windowsprogrammers.  Suddenly, an entire new programming/display methodology isopened up.  We will explain HSP thoroughly in the paragraphsbelow.  

    But even with HSP, there two other issues which may stop someone from embedding IEX controls and ASP/HTML content in their Windows program.   The following identifies the problems and how EzTools' products solve them.

    Problem 1: File Proliferation

    File proliferation is simply when the file count of your application distribution gets too high. Typically, a webpage is not simply a single file, but many files (such asgraphic files), that are referenced by the webpage. Shipping several"raw" HTML files with your product is potentially a bad idea because:1) it can dramatically increase the "file count" of your product. 2)if any of these files are accidentally deleted, it may be difficult to ascertainwhich they are, and 3) raw files can be tampered with or viewed by end users thus exposing your intellectual property.  All ofthese are good reasons not to use them.  But there is a perfect solution tothis problem.  That is, the use of contentstorage files and pluggable protocols.  We will also deal with content storage file security.

    Problem 2: Webpages Can't Interact with Application

    You should be able to detect mouse clicks on the webpage links and buttons and be able to pass them through to the containing application code (in the form of COM events) so you can respond to them outside the scope of the IEX control.  This is necessary so your webpages can reach outside the scope of the webbrowser control.  You would also want to be able to disable the right-click Context Menu and accelerator keys as well.  We will see how we can detectmouse-clicks (and other HTML events) in webpages and pass them through to the containingapplication. We will see how to put all of these new technologies together to form a new andunique programming paradigm.

    Besides the fact that IE doesn't natively pass through HTML events, amazingly you cannot set the window border to be on or off, nor can you set the style to be 3D or flat - its always 3D!  We will show you how EzTools' products solve all of these problems, letting you to "have it your way".  To writeWindows programs that make effective use of embedded IEX controls, you will needall of these features.

    Pluggable Protocols

    IE uses pluggable protocols to obtain all of its content. Whenever youtype a URL such as

    http://www.microsoft.com

    IE looks up the http pluggable protocol Registry entry and loads theappropriate COM object to go get the content. It is entirely the job of the pluggable protocolto get the specified content resource, the way it knows how according to itsprotocol. Once the resource data has been retrieved, the pluggable protocolfeeds it back to IE. The HTTP pluggable protocol uses HTTP to get the resource.The FILE pluggable protocol uses the file system to get the resource.  FTP uses the FTP pluggable protocol, and so on.  We will see you can use a custom pluggable protocol to read content from a special file called a content storage file.

    EzStor and Content Storage Files

    EzStor is an application program that provides a User Interface (or UI) forcreating content storage files.  A content storage file is a sort of file databasefor storing multiple files in a single file.  You create a content storage file by dragging anddropping your HTML content files from Windows Explorer onto a Treeview in theEzStor app. As you drop files andfolders onto EzStor, they are copied into a storage file, maintaining the samehierarchy as your file system. You can create your own hierarchy as well. EzStorhas an embedded IEX control that displays the content files as you select them.To do this, it uses its own pluggable protocol developed for it. The EZS pluggable protocolknows how to read the EzStor content storage file. When you select a file,EzStor tells its IEX control to navigate to the file using the EZS pluggable protocol.

    So now you can specify the EZS protocol to load a WebPage storedwithin an EzStor file.  It has the following syntax:

    ezs://drive:\filepath\filename.ezs/internalpath/htmlfilename

    Example:

    ezs://c:\myezhfile.ezs/myhtmlfile.htm

    You can do this either programatically (using the Navigate method of IEX) ortype it in the address bar of IE.

    OK, at this point you have two tools that enable you tosafely store your HTML/ASP/graphiccontent in a single content storage file (EzStor files) to be able to be read byembedded IEXcontrols in your Windows programs. You can stuff all of your content files intoa single file to be shipped with your product, along with the EZS pluggableprotocol DLL. 

    Using EzStor and and the EZS pluggableprotocol DLL we have solved problem number 1 - file proliferation.  But theEZS pluggableprotocol will only display static webpages.  If your application onlyrequires static pages, then this solution is all you need.

    Dynamic Webpages with HTML Scripting Pages

    Displaying static HTML webpages in your apps is pretty good. You can doquite a bit with static webpages. But we cantake it a huge step further and have dynamic webpages using a new technologynamed HTML Scripting Pages, or HSP for short. HSP is a client-side, ASPwork-alike. Think of HSP as IE + pluggable protocols + Windows Scripting.  HSP isimplemented in its own pluggable protocol DLL, so it works seamlessly with IE. Ituses Windows Scripting (aka Active Scripting) to execute script code embeddedwithin HTML pages, just like server-side ASP. The difference is that it all takes place onthe client machine - there is no webserver involved.

    HSP uses most of the same objects as ASP (eg. Session, Request andResponse, Server).Each object has most or all of the same properties and methods of its ASPcounterpart. The reason not all objects, methods and properties are implementedis simple: They are not needed in a client-only, single user environment. 

    HSP works with any Windows Scripting engine that supports scriptableCOM objects (IDispatch). HSP only looks for script in files with the .aspextension.

    Hello World

    Suppose you have an HTML file with the following line in it:

    Hello <% Response.Write "World" %>

    When loaded by IE, this would be displayed:

    Hello World

    If you had a QueryString or Form value passed with a user name, you couldwrite:

    Hello <% Response.Write Request("UserName") %>

    or just

    Hello <% = Request("UserName") %>

    HSP and EzStor

    HSP's pluggable protocol is HSP. You load an HSP resource in the sameway as any other pluggable protocol:

    hsp://c:/myproj/myfile.hsp

    When IE sees the HSP protocol specified, it loads the HSP DLL and calls a COMobject to retreive the specified resource.  The HSP protocol knows how toread EzStor files just as does the EZS protocol.  Although HSP will open and execute"raw" files files from disk, that is not the way it is used in yourdeployed applications. Rather, you should stuff all of your HTML, graphics, ASP and other contentfiles into an EzStor file (using the EzStor tool).  We do this for the reasons outlined above. But now that wehave executable program code in our files, it becomes even more important thatend users don't tamper with them.

    Note: You can take advantage of the new VBScript Classes - COM classesimplemented entirely in VBScript - to write reusable classes in your HSPcode.  Quite a powerful feature.

    WOW

    So we are now displaying static or dynamic HTML content in our Windows programs, and, thanks topluggable protocols, the content is retrieved from neatly bundled contentstorage (EzStor) files.That's a big step forward.  Now suppose you wanted to activate program functionsfrom mouse-clicks on the webpage - a function that is outside the scope of IE. For example, when you open Microsoft Outlook, and click "OutlookToday", you are shown a webpage in the right-hand window pane, with linksand graphics on it. Clicking on a link activates the corresponding programfunction. The IEX event model doesn't pass through mouse-clicks, so how is yourapplication codegoing to know when a link is clicked? The WOW control (WOW is for Web OnWindows) handles this by wrapping the IEX control to pass these events through to your program as a COM event.  WOW canactually trap any HTML event.  Now, when the userclicks on a link you could activate an internal program function such asdisplaying a dialog window, or changing forms, or whatever.  WOW lets you usethe IEX more as a classic ActiveX control that interacts with itscontainer program.

    This feature is very important.  There are situations where you just can't do without it. Besides this feature, WOW gives you the ability disable the Context Menu and any or all accelerator keys, another important feature.

    Security

    EzStor has built-in security features that can make it impossible forunauthorized or unlicensed persons to open, execute or examine the contents ofyour EzStor files. Without security, anyone would be able to run your HSPapplication. Also, anyone with the EzStor Viewer could view the contents of yourHSP EzStor files, including your source code.  EzStor's licensing feature allows you to copy protect your HSP files so that they can only be run on licensed machines.

    EzStor has two levels of security: Password and Machine License. EzStorallows you to set a password on your storage file, so that it cannot be openedunless the correct password is supplied. You can also set a Machine License, so that the file cannot beopened or run unless a license key is detected on that machine. To do this, the EzRegproduct is required. You might require a password or machine license if you sellyour HSP program (for example if you produce educational courseware) that you need to copyprotect to guard your content, product and revenue.

    Conclusion

    These technologies introduce a totally new programming paradigm that, thoughWindows centric, can be used in a variety of applications on a large installedbase of computers.  All Windows machines have Internet Explorer installed, and the latest version can be obtained from Microsoft for free.  TheWindows Scripting DLLs are also free and readily available from Microsoft. Being able to write a  secure, copy protected executable program that can run in the IE browser or inyour own custom programs is quite an interesting prospect.  The web browser actually becomes a sort of programmable whiteboard for a wide variety ofuses, using HTML and VBScript.  Only EzTools' integrated products give you the ability to do it.

    This article is copyrighted by Brett Goodman andEzTools - 2000-2001.  All rights reserved.

    Reach me at www.eztools-software.comor brettg@eztools-software.com


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More ASP Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    IBM DB2 Deep Compression ROI Tool

    The IBM DB2 Deep Compression ROI tool is designed for DBA’s and IT management personnel to perform a clinical analysis of the cost savings gained from the Storage Optimization feature of DB2 9 for Linux, UNIX and Windows. The feature, also known as Deep Compression, compresses data that lies within a database by up to 80% at times.
    FREE! Go There Now!


    NEW! Accelerating Software Innovation on i on Power Systems

    Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, for an overview of Rational’s new software offerings and resources to help modernize and accelerate software innovation on i on Power Systems – while ensuring past application investments are protected and continue to grow. Learn how these solutions are helping customers extend their core i5/OS solutions toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time.
    FREE! Go There Now!


    NEW! Best practices for software analysis: An introduction to the IBM Rational Software Analyzer application

    This whitepaper presents the benefits of successfully introducing static analysis into your organization using IBM Rational Software Analyzer. Additionally, it identifies some common pitfalls that can hinder the effective use of static analysis tooling as well as presents 10 simple strategies designed to help you quickly realize the value of static analysis using Rational Software Analyzer.
    FREE! Go There Now!


    NEW! Did you say mainframe? e-kit

    Learn how you can extend modern application lifecycle management to IBM System z through the IBM Rational Software Delivery Platform (SDP). The Did you say mainframe? e-kit includes podcasts, webcasts, tutorials, white and red papers, demos, and articles designed to help ease the challenges of modernizing your enterprise. This complimentary kit for mainframe developers is a practical, how-to guide for making the most of an existing development environment, including the skills and infrastructure already in place at an established enterprise.
    FREE! Go There Now!


    NEW! Download IBM Rational Developer for System z

    Download a free trial version of IBM Rational Developer for System z, software that can help you deliver core development capabilities; the power of Java Platform, Enterprise Edition (Java EE); and rapid application development support to diverse enterprise application development teams. With comprehensive development tools to help create, deploy and maintain traditional enterprise and composite applications, Rational Developer for System z enables developers with different technical backgrounds to easily participate in important technology projects.
    FREE! Go There Now!


    NEW! IBM Rational Systems Development e-Kit

    As systems increase in complexity, communication between systems and software teams becomes more and more difficult. Now, there’s a way to improve product quality and communication.<br />Read the “Model Driven Systems Development” white paper to see how. Also included in this kit are more educational white papers, customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems.<br />
    FREE! Go There Now!


    NEW! Rational Talks to You: Grady Booch on Architecture

    Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered!
    FREE! Go There Now!


    NEW! Section 508 of the U.S. Rehabilitation Act: Web accessibility compliance

    Because access to government information continues to be an area of concern for many U.S. citizens with disabilities, the U.S. government enacted Section 508 of the Rehabilitation Act in 2001 to ensure that government agencies create accessible Web content, enabling all citizens to access the information they need. A fully accessible Web site makes Web content accessible to all individuals, including those with disabilities, who may be accessing Web content via a variety of user agents. Common user agents include standard Web browsers, text-only browsers, assistive devices and mobile devices such as cell phones or personal digital assistants (PDAs).
    FREE! Go There Now!


    NEW! The dirty dozen: preventing common application-level hack attacks

    As organizations have grown increasingly dependent on online software, the risk of malicious attacks has also become far more serious. Fortunately, well-governed organizations can protect their Web applications by injecting vulnerability assessments and ethical hacks into their software development and delivery processes. This paper describes 12 of the most common hacker attacks and provides basic rules that you can follow to help create more hack-resistant Web applications.
    FREE! Go There Now!


    Refresh! IBM Rational Systems Development Solution eKit

    With IBM Rational Systems Development Solution, you can deliver products faster with higher quality. Within this kit, Read the “Model Driven Systems Development” white paper to see how to improve product quality and communication. Then check out the rest of the e-Kit to learn more about important topics that can affect the success of any software project through customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems. From start to finish, at every stage in your projects, Rational Systems Development Solution can help your company reach its full potential.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    ASP ARTICLES

    - ADO for the Beginner
    - ADO.NET 101: Data Rendering with a DataGrid ...
    - Introducing SoftArtisans OfficeWriter 3.0 En...
    - Getting Remote Files With ASP
    - The Real Basics of Functions in ASP
    - Enhancing Readability with ASP
    - Mimicking PHP's String Formatting Functions
    - Windows Server Hacks 12, 77, and 98
    - How to Sort a Multi-Dimensional Array
    - Developing an Information Management Tool wi...
    - What are Active Server Pages?
    - Getting Remote Pages with ASP
    - FTP’ing Files with ASP
    - Apply Single-Sign-On to Your Application
    - Easy Error Management





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway