Classic ASP and ASP.Net - The "Big" Picture?

Discussion in 'ASP General' started by Metre Meter, Jan 6, 2010.

  1. Metre Meter

    Metre Meter Guest

    While I've been supporting a Classic ASP app for a while, and have
    also written some separate ASP.Net apps, my understanding is vague on
    some larger issues

    - What are the issues with mixing languages in Classic ASP? For
    example, declaring variables, functions etc. in one language and
    accessing/calling them in another?

    - Where is the line between "native" language features (e.g. in
    JScript), and those features which are part of .Net (or whatever),
    common to all .Net languages? Or put another way, how are the .Net
    facilities "mapped" onto a particular language?

    - What environment does Classic ASP operate within (i.e. analogous to
    ASP.Net programs operating under CLR)?

    - What support to I have for the "native" Windows features under
    ASP.Net? Is everything done through the CLR? Do I have more direct
    access to Windows' native features under Classic ASP, or does that
    restrict me in a different way? Is there anything in that vein that I
    can do in Classic ASP that I can't do in ASP.Net?

    - Do any languages (particularly JScript) have issues accessing the
    full features of the Classic ASP or ASP.Net environment?
    (I had a problem with JScript and collections once, but I was able
    to work my way around it)

    - Which is the best way to stucture my programs made up of multiple
    files?
    - Via #includes or via <script> tags? The latter sounds better,
    but how do I include a jscript file within a jscript fileif there are
    dependencies
    - Should I really be developing ASP.Net "by hand" or using Visual
    Studio anyway?

    - What "type" of object does Server.CreateObject in Classic ASP
    create?

    I apologise if these questions seem somewhat vague, or if there are a
    lot of them. As they're somewhat interconnected, please feel free to
    answer them by pointing me towards any online resources. Any help is
    appreciated- thank you!
     
    Metre Meter, Jan 6, 2010
    #1
    1. Advertisements

  2. Metre Meter

    Bob Barrows Guest

    I'll start by suggesting you might benefit from reading the classic ASP
    documentation: http://msdn2.microsoft.com/en-us/library/ms524664

    better asked in a dotnet group (this is a classic asp group)

    microsoft.public.dotnet.framework.aspnet
    www.asp.net
    Not sure I understand the question. ASP is run by an IIS server using
    asp.dll
    again, better asked in a dotnet group
    Are you talking about access to the windows api? Don't even think about
    it with script languages, which is all that classic ASP supports.
    I won't answer for .Net, but for classic ASP the answer is no
    http://www.aspfaq.com/show.asp?id=2176
    doesn't seem to be a question
    For server-side code, I typically use server-side includes (#includes).
    ??? just do it?
    Are you talking about client-side or server-side code?
    better asked in a dotnet group
    Whatever type is provided by the type library being referenced ...

    set rs=createobject("adodb.recordset") causes the creation of an ADO
    recordset object and returns a reference to it to the rs variable.

    The "Server." part is not really necessary anymore. It used to be
    recommended in earlier versions of IIS but is merely overhead now. Use
    vbscript's CreateObject method instead.
     
    Bob Barrows, Jan 6, 2010
    #2
    1. Advertisements

  3. Metre Meter

    Tim Slattery Guest

    As far as I know, different languages live in different spaces. If
    your ASP code contains blocks of VBScript and of server-side
    JavaScript, the variables from VBScript will not be available to the
    Javascript code. I don't think mixing languages like that is a good
    idea anyway.
    Can't help with .Net questions.
    Classic ASP is implemented by a filter that runs under IIS.
    For classic: I think JavaScript can do anything that VBScript can do.
    For .Net: no clue
    An ActiveX component. It's implemented as a DLL, which must be
    registered on the server. I've written such things in both VB and C++.
    No doubt it can be done in other languages as well.
     
    Tim Slattery, Jan 6, 2010
    #3
  4. Metre Meter

    Bob Barrows Guest

    You can call vbscript functions from a jscript block and vice versa:
    http://msdn.microsoft.com/en-us/library/aa260861(VS.60).aspx
     
    Bob Barrows, Jan 6, 2010
    #4
  5. Metre Meter

    Evertjan. Guest

    Bob Barrows wrote on 06 jan 2010 in
    microsoft.public.inetserver.asp.general:
    functions and also variables are available to both:

    ==================

    <% = a %>
    <br>
    <% = b() %>

    <script language ='javascript' runat='server'>
    var a = 'Blah';

    function b() {
    return 'Blip';
    };
    </script>

    ==================
     
    Evertjan., Jan 6, 2010
    #5
  6. Metre Meter

    Metre Meter Guest

    Yes, I'd come across that issue before, but that page lays it out
    particularly clearly, thank you. It can definitely be a nuisance if
    you don't understand that. :-/
    Will do, thank you.
    Sorry, that was badly phrased, probably because I hadn't thought it
    out too well. Is there a resource that gives an overview of how the
    different parts of IIS (including Classic ASP) work together, which
    parts do what, and which processes run which, etc.?
    But the methods I can call on the Server.CreateObject created objects
    are those of the same ADO COM object created by any other machines
    (barring security considerations), right?
    It was a side-note for the previous question
    I get the impression that it's more a matter of personal choice (at
    least as far as Classic ASP goes)?

    Server-side JScript; e.g. if we have file foo.js which contains...
    var blah = "whatever";

    function some_function(in_param) {
    return blah + another_function(in_param);
    }

    Then we have to include foo.js in our ASP file ("parent.asp") like
    so...
    <script language='jscript' runat='server' src='foo.js'></script>

    But... some_function() in foo.js uses another_function(), which is
    defined in bar.js, so we need to include that. But we can't include
    <script> tags within foo.js itself, nor #include, because it's a
    JScript file. We can of course add
    <script language='jscript' runat='server' src='bar.js'></script>
    in "parent.asp", but we have to remember to do that ourselves. Or
    perhaps we should just #include our code file instead, like you said?
    So it's generally a COM object of some sort?

    Thanks for the feedback,

    - MM
     
    Metre Meter, Jan 7, 2010
    #6
  7. Metre Meter

    Metre Meter Guest

    An ActiveX ADO COM object?

    - MM
     
    Metre Meter, Jan 7, 2010
    #7
  8. Metre Meter

    Metre Meter Guest

    Thanks for all the feedback on this subject.

    -MM
     
    Metre Meter, Jan 7, 2010
    #8
  9. Metre Meter

    Bob Barrows Guest

    It doesn't have to be ADO. ADO is just one of many COm objects available.
    For example, you can use CreateObject to instantiate a FileSystemObject:

    set fso=createobject("scripting.filesystemobject")

    You can even create your own ActiveX (COM) object as Tim described.
     
    Bob Barrows, Jan 8, 2010
    #9
  10. Metre Meter

    Bob Barrows Guest

    Bird's-eye view:

    IIS is a web server. It processes http requests* from clients, using ISAPI
    filters to decide what to do with the requests. For .htm and .html requests,
    it simply sends the requested page as the response. For .asp pages, it
    passes the request to the asp.dll, which provides the objects described in
    the documentation I pointed you at. The server-side script in the requested
    ..asp file runs and generates html which is written to the response and
    passed to the client.

    There's really not much more you need to know about the inner workings. But
    if you're interested, I suggest you read the documentation I pointed you at
    earlier.
    Other machines? No, it can only access activex dlls that are installed
    (registered) on the machine on which the script is running.
    Yes. Personally, I always use ssi's for server-side code, or bits of html
    that need to be used in multiple files.
     
    Bob Barrows, Jan 8, 2010
    #10
  11. Metre Meter

    Metre Meter Guest

    I've no idea why I typed "machines", because it's certainly not what I
    meant(!) I'm pretty sure that it should have read by any other means".
    That's very informative, thanks. So I can create all sorts of COM
    objects, so long as they've been registered with the server?

    - MM
     
    Metre Meter, Jan 8, 2010
    #11
  12. Metre Meter

    Bob Barrows Guest

    Exactly.
     
    Bob Barrows, Jan 8, 2010
    #12
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.