Accessing .asp subroutines remotely

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • liz0001
    New Member
    • Jun 2007
    • 26

    Accessing .asp subroutines remotely

    Hi,

    I need to access an .asp subroutine file from a subdomain.

    i.e. the website is at www.domain.com and I want to access the same subroutines on the subdomain mobile.domain.c om.

    The normal #include and #virtual don't seem to be working remotely.

    I have also tried:

    url = "http://<domain>/subroutines.asp "
    set xmlhttp = CreateObject("M SXML2.ServerXML HTTP")
    xmlhttp.open "GET", url, false
    xmlhttp.send ""
    Response.write xmlhttp.respons eText
    set xmlhttp = nothing

    and it doesn't error out, but the subroutines don't seem to be accessible.

    Ideas? thanks.
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    actually sounds like a server issue to me. Let me ask an IIS expert to weigh in.

    Jared

    Comment

    • Denburt
      Recognized Expert Top Contributor
      • Mar 2007
      • 1356

      #3
      Yes this would be a server issue as an include tag such as this is called a Server Side Include or SSI. Do you have access to the servers directory structure or are you uploading to a remote server someplace? This is important, if it is the latter then there may be certain restrictions on what you can use and how you can use it. Such as using various file extensions and such.
      It sounds as though you are trying to move up on the directory structure as such. <!--#include virtual="../header.html" -->
      So it may be as simple as that a simple .. or ../../ for moving up two directories depending on where the file resides the server may require a full path name even it really depends on the server and the restrictions that they put on it and where the file resides in relation to the file that calls it.

      here is a link that may help.
      W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
      Last edited by Denburt; May 5 '09, 04:27 PM. Reason: Link

      Comment

      • liz0001
        New Member
        • Jun 2007
        • 26

        #4
        I have looked through your reply and tested out your suggestions. The problem is that my subdomain, even though it is physically located in a subdirectory, is treated as a completely separate entity. Therefore I can't access the subroutine file through a relative path. (

        <!-- #include file ="../ActionFiles/subroutines.asp " -->

        gives the error:

        "The Include file '../ActionFiles/subroutines.asp ' cannot contain '..' to indicate the parent directory. "

        )

        I am uploading to a remote server with a shared hosing package, so I don't have control over the server variables. Is there a setting I could ask support to change to allow me to include a remote file?

        It looks to me like the problem is more that the .asp code won't execute. It does read in the file through the MSXML2.ServerXM LHTTP object, and if I take off the <% %> asp tags it will display the actual text. It just won't allow me to use the subroutines.

        Is there a way I can specify for the read-in file to execute early enough to use those subroutines in the page?

        Comment

        • Denburt
          Recognized Expert Top Contributor
          • Mar 2007
          • 1356

          #5
          You stated that it is in a sub directory so the two dots shouldn't be necessary that will only take you to the parent. You also stated that you can read text from an include of this sort so obviously you have the paths straight, now as to why you can't call the subroutines there could be a lot of reasons for that. If it is loading the file then you should be able to call the subroutines in it.
          As to your question about the file that is read in and if you are calling it early enough yes it loads before any scripting on the page. Quoting from the link I posted earlier:
          Included files are processed and inserted before the scripts are executed.
          You may have an error in the script or something there that is hanging it up I really can't say. If I were you I would try to break it up so that I only have one subroutine then add them each in one at a time till you see where it breaks. If need be start with something really simple call that and make sure it works then go from there.

          Comment

          • GazMathias
            Recognized Expert New Member
            • Oct 2008
            • 228

            #6
            Couple of thoughts

            <!-- #include file ="../ActionFiles/subroutines.asp " -->

            gives the error:

            "The Include file '../ActionFiles/subroutines.asp ' cannot contain '..' to indicate the parent directory. "
            Would Enable Parent Paths in IIS cure that?

            Also are the User credentials the same in the sub domain as they are in the root?

            Comment

            • liz0001
              New Member
              • Jun 2007
              • 26

              #7
              Thanks for working at this with me.

              Let me clarify my problem, correct me if I am wrong:

              1) Subdomains are treated as separate entities by asp (as evidenced by the session variables not transferring).

              2) Therefore using any sort of relative path shouldn't work.

              3) So the path must be a complete address.

              4) <!-- #include file="..."> and <!-- #include relative="..."> do not allow complete addresses, all paths must be relative.

              5) So I have to read in the subroutine file via a different method.

              6) The MSXML2.ServerXM LHTTP object will read the contents of the remote file that I want and execute them. (if I have a subroutine and a call to that subroutine in the remote file, it will execute.)

              HOWEVER - I CANNOT CALL THE SUBROUTINES IN THE ORIGINAL PAGE.

              My original page is treating the subroutines as if they do not exist. No errors, but no execution.

              **And this is where I'm stuck.

              Thanks.

              Comment

              • jhardman
                Recognized Expert Specialist
                • Jan 2007
                • 3405

                #8
                Originally posted by liz0001
                Thanks for working at this with me.

                Let me clarify my problem, correct me if I am wrong:

                1) Subdomains are treated as separate entities by asp (as evidenced by the session variables not transferring).
                this is also not an ASP issue, but a server issue. It is the server that maps different directories to different websites. If you just made directories from the command line there is no reason an ASP page wouldn't recognize all of them as being in the same website. That said, I am aware that dreamweaver's implementation of ASP would separate each directory into its own website, and there are probably other programs that do that as well. If you don't have direct access to the server than there isn't much you can do about that, but I have done that type of thing many times.
                2) Therefore using any sort of relative path shouldn't work.

                3) So the path must be a complete address.

                4) <!-- #include file="..."> and <!-- #include relative="..."> do not allow complete addresses, all paths must be relative.

                5) So I have to read in the subroutine file via a different method.

                6) The MSXML2.ServerXM LHTTP object will read the contents of the remote file that I want and execute them. (if I have a subroutine and a call to that subroutine in the remote file, it will execute.)

                HOWEVER - I CANNOT CALL THE SUBROUTINES IN THE ORIGINAL PAGE.

                My original page is treating the subroutines as if they do not exist. No errors, but no execution.
                for a real server-side include the include needs to be pulled up by the server BEFORE the asp is executed. that's why what you are trying to do won't work, you are pulling the text of the file in with ASP instead of before. This would be a terrible security risk, but you could theoretically open both files (the include and the asp file) in a separate asp page and merge them on the fly, then redirect to the newly merged file. This would accomplish the same thing as the include: the include file is accessed and linked to the asp page BEFORE the asp is run
                **And this is where I'm stuck.

                Thanks.
                Without more details it is hard to give better suggestions, but I am inclined to say that it sounds like a job for a web-service.

                Jared

                Comment

                • GazMathias
                  Recognized Expert New Member
                  • Oct 2008
                  • 228

                  #9
                  4) <!-- #include file="..."> and <!-- #include relative="..."> do not allow complete addresses, all paths must be relative.
                  To reiterate:

                  Setting Enable Parent Paths in IIS will allow the use of "../"

                  Gaz

                  Comment

                  • liz0001
                    New Member
                    • Jun 2007
                    • 26

                    #10
                    THANK YOU!! I was able to enable the parent paths and include the files!!

                    Comment

                    • Denburt
                      Recognized Expert Top Contributor
                      • Mar 2007
                      • 1356

                      #11
                      Very nice glad you've got it. If there is anything else we can do we'll be here.

                      Comment

                      Working...