ASP
Cookies in Javascript: Handling Session Information
Cookies written using Javascript is a technique that enables a wensite owner to store information about a given user for submission in a form, or so manipulation at a later browsing session by the same use. Being that cookies are stored on the user's machine (client-side), they do not present a fail-safe way to handle information, but they are essential in accomplishing this task in situations where the web programmer does not have access so server-side programming and scripting plateforms such as ASP, JSP and PHP (just to mention a few).
Adding classic ASP #include functionality in ASP.NET
.NET or ASP.NET is touted to be more powerful, versatile and future-compatible that the now archaic ASP server-side programming language. To mention a few, the .NET architecture is built to support XML natively, and it supports more powerful and robust server-side programming languages such as C# and Visual basic in contrast with ASP which mainly supports VBScript which as the name suggests is a non-compiled scripting language.
Migrating from writing simple back-end procedures in ASP using Visual Basic Script (VBScript) or JScript to ASP.NET can prove to be difficult because of the different approaches. Some functionality such as the use of #include to include external static and ASP (dynamic) files has been eliminated altogether in ASP.NET. This is not a limitation to .NET in the bigger picture as the framework/architecture provides for a more powerful and robust approach to building more powerful and robust application, but it can prevent a web developer from quickly #including and re-using.
In this document, we will explore a native ASP.NET approach that can provide benefits similar to those of the #include functionality of classic ASP.
Highlights
- Uses a method already available in .NET
- Has the same functionality as #include with the exception that the included file cannot contain dynamic
Implementation
The Response object in ASP.NET has a WriteFile method that can be used to directly write the contents of a static file (cannot have dynamic code in it) into the output stream of an aspx.
<html>
<body>
<div id="my_server_side_include">
<% Response.WriteFile ("include_AFF.inc")%>
</div><!-- END CSS my_server_side_include -->
A more complex approach
Because of the significant difference that is mentioned above (inability to include dynamic content), one my seek a different approach that can indeed provide the same funttionality as the classic ASP #include and more. The following process is outlined in the Microsoft Developer Network simulates include Files with an ASP.NET Server Control. Is more powerful, but also takes more time and knowledge to implement.


