help writing a multiple table query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #91
    Originally posted by mbatestblrock
    that sounds perfect! thank you for all the help you've provided me, I am searching on this issue as well, but having an extremely rough time trying to even figure out a search phrase..

    Hopefully the IIS gurus can lend a hand!

    I am running verison 6 if that helps.

    again i dont even know how much I could thank everyone for this. It kinda took a total 180 from where it started, but we got it!

    Ill keep checking for the iis updates.


    -mike
    I'm no IIS expert but I would guess that the IIS user does not have permissions on that network share. See if opening up the permissions temporarily to allow read/write access to everyone might help the situation.

    Comment

    • mbatestblrock
      New Member
      • Sep 2007
      • 164

      #92
      Okay, I hate to be pressing my luck here.. but heres what I am running into..

      I copied all of the terminfos into that directory..

      The text files aren't always laid out the same, and suppose this creates a problem.

      I mean they are LAID out the same, they just are in a slightly different order..

      For instance the terminal numbers are sorted the opposite way, starting with 6 and ending with 2. so the script comes back with things like #3 is not set as backup. and number two is set as backup -as if it was an error.

      I think you get the idea.. I was hoping there was a way to fix this. I hope it makes this makes sense I am on the phone and trying to help someone with hardware and typing this at the same time!


      let me know if you need more info. I sent you (mark) an example of one of those certain files.

      Comment

      • mbatestblrock
        New Member
        • Sep 2007
        • 164

        #93
        Originally posted by RedSon
        I'm no IIS expert but I would guess that the IIS user does not have permissions on that network share. See if opening up the permissions temporarily to allow read/write access to everyone might help the situation.

        I am going to give this a shot in a few minutes! if that does work, (i am no IIS expert either) how would I find the system name or the user name for the IIS server so I am not leaving this open to everyone?

        Comment

        • RedSon
          Recognized Expert Expert
          • Jan 2007
          • 4980

          #94
          Originally posted by mbatestblrock
          I am going to give this a shot in a few minutes! if that does work, (i am no IIS expert either) how would I find the system name or the user name for the IIS server so I am not leaving this open to everyone?
          I think when you install IIS it creates some system user accounts. Try looking for user names with IIS in the name. Probably a quick MSDN search would reveal this answer too.

          Comment

          • markrawlingson
            Recognized Expert Contributor
            • Aug 2007
            • 346

            #95
            Originally posted by mbatestblrock
            Okay, I hate to be pressing my luck here.. but heres what I am running into..

            I copied all of the terminfos into that directory..

            The text files aren't always laid out the same, and suppose this creates a problem.

            I mean they are LAID out the same, they just are in a slightly different order..

            For instance the terminal numbers are sorted the opposite way, starting with 6 and ending with 2. so the script comes back with things like #3 is not set as backup. and number two is set as backup -as if it was an error.

            I think you get the idea.. I was hoping there was a way to fix this. I hope it makes this makes sense I am on the phone and trying to help someone with hardware and typing this at the same time!


            let me know if you need more info. I sent you (mark) an example of one of those certain files.
            Sorry I was under the impression that the first terminal that is displayed is always #2.

            Here's a fix...

            [CODE=ASP]
            If Val(oText.Line) = 4 Then
            [/CODE]

            Find the line above and replace it with..

            [CODE=ASP]
            If InStr(Left(Trim (aTerminal(0)), 2), "02") > 0 Then
            [/CODE]

            This will look at the terminal name to make sure that the first two characters are 02 before checking whether it's status should be "Backup" - this way it doesn't matter which line it is on.

            Of course, I'm assuming that it's always terminal 02 that is supposed to be set as "Backup" and that its name will always start with 02.

            Sincerely,
            Mark

            Comment

            • markrawlingson
              Recognized Expert Contributor
              • Aug 2007
              • 346

              #96
              Originally posted by RedSon
              I think when you install IIS it creates some system user accounts. Try looking for user names with IIS in the name. Probably a quick MSDN search would reveal this answer too.
              Hmmm, I'm wondering if you were to go to... My Computer --> Right click the mapped network drive (I think you said it was F:\) --> Properties --> Security Tab --> You should see the groups or usernames --> Click Everyone --> Make sure the checkbox under 'Allow' for 'Read' is checked off.

              Or you may even want to just apply this to IIS's annonymous user account which is (usually) called IUSER_COMPUTERN AME - but may appear in this list as Administrator (COMPUTERNAME\A dministrators) - Or even the System username.

              You can find out who the "Owner" of the F:\ Drive is by clicking the advanced button at the bottom and then clicking on the "Owner" tab. It should say "Current owner of this item:"

              If this doesn't work - try giving every account listed full permissions and see if the script works then. If it doesn't, just revert it back to the way it was. If it does - you know at least something worked and it's a trial and error sort of deal going through each user account and updating their permissions for the drive to 'Read' (for security purposes) until eventually the script fails - then you know which account needs permissions for this drive.

              Sincerely,
              Mark

              Comment

              • mbatestblrock
                New Member
                • Sep 2007
                • 164

                #97
                can someone post the straight text code again, I am idiot and did not save a file with it, and I goofed it up by trying to edit it.. I cant figure out why I cant reply to the post.. but it doesnt work for me

                Comment

                • RedSon
                  Recognized Expert Expert
                  • Jan 2007
                  • 4980

                  #98
                  Here is another thing to try: when you map a drive you are basically making a short cut from \\domain\foo\ba r to X:\. So instead of doing X:\MyFileName try doing something like \\domain\foo\ba r\MyFileName. Or alternatively you can treat the file location as a URL, the various Microsoft technologies should be able to parse the \\*\*\ notation.

                  Comment

                  • markrawlingson
                    Recognized Expert Contributor
                    • Aug 2007
                    • 346

                    #99
                    Here you go.

                    <%
                    'Replace this value with the path to the folder where the files are kept
                    sFolder = "D:\Inetpub\www root\netTest\Te st\Reports"
                    bError = False
                    'Open the File System Object
                    Set oFSO = Server.CreateOb ject("Scripting .FileSystemObje ct")
                    'Open the folder to return a list of the files held within it.
                    Set oFolder = oFSO.GetFolder( sFolder )
                    Function Val( sValuePrivate )
                    Set oRegExp = New RegExp
                    oRegExp.Pattern = "[^0123456789\.]"
                    oRegExp.IgnoreC ase = True
                    oRegExp.Global = True
                    Val = Abs( oRegExp.Replace ( "0" & sValuePrivate, "" ) )
                    Set oRegExp = Nothing
                    End Function

                    'Loop through each file in the folder
                    For Each File In oFolder.Files
                    'Open the text file.
                    Set oText = oFSO.OpenTextFi le(File)
                    'Skip the first 2 lines because it's just column delimited garbage and contains no information we care about as far as this code goes
                    oText.SkipLine
                    oText.SkipLine
                    'Read each line there-after of the file
                    Do Until oText.AtEndOfSt ream
                    'Split the data on the line into an array so we can manipulate the data easier.
                    aTerminal = Split(oText.Rea dLine, ",")
                    'If we're on line 2, we want to make sure this terminal is set to backup
                    If InStr(Len(Trim( aTerminal(0)),2 ), "02") > 0 Then
                    'Make sure line 4, column 2 reads as Backup. If it doesn't, display an error stating that it is NOT set to backup.
                    If Trim(aTerminal( 1)) <> "Backup" Then
                    Response.Write "<font face='Verdana' size='1' color='red'>NOT E! " & Replace(File.Na me,".txt","") & " does not have " & aTerminal(0) & " as backup!</font><br/>"
                    bError = True
                    End If
                    'Else, if we are on any other line
                    Else
                    'Check to make sure column 2 of any other line does not say backup, if it doesn't, display an error stating there is a problem.
                    If Trim(aTerminal( 1)) = "Backup" Then
                    Response.Write "NOTE! " & Replace(File.Na me,".txt","") & " has " & aTerminal(0) & " as Backup!<br/>"
                    bError = True
                    End If
                    End If
                    Loop
                    oText.Close
                    Set oText = Nothing
                    Next

                    Set oFolder = Nothing
                    Set oFSO = Nothing
                    %>
                    <html>
                    <head>
                    <title>Error Report for Terminal Servers</title>
                    </head>
                    <body>
                    <% If bError = True Then %>
                    <form name="oForm" id="oForm" action="?" Method="POST">
                    <input type="Submit" value="Generate a Report"/>
                    <% Else %>
                    <font face="arial" size="1" color="green">T he system is nominal. No errors to report!</font>
                    <% End If %>
                    </form>
                    </body>
                    </html>

                    That should do the trick. Let me know when you're done, i'll see if I can remove the text from my post - if not i'll get a mod or an admin to do it.

                    Sincerely,
                    Mark

                    Comment

                    • markrawlingson
                      Recognized Expert Contributor
                      • Aug 2007
                      • 346

                      Originally posted by RedSon
                      Here is another thing to try: when you map a drive you are basically making a short cut from \\domain\foo\ba r to X:\. So instead of doing X:\MyFileName try doing something like \\domain\foo\ba r\MyFileName. Or alternatively you can treat the file location as a URL, the various Microsoft technologies should be able to parse the \\*\*\ notation.
                      I thought about that and looked it up a couple hours ago and the concensus seems to be that you can't do it because of the way that the file system object works. I believe that will throw a "Invalid character" error.

                      Now that I think about it though I guess you could use the XML DOM to SCRAPE the contents of each of the files if you know the http://www.domain.com/foo/bar type location of the directory. You could scrape the contents, save it to a text file on the server's hard drive, and then point the FSO to that physical path.

                      But something tells me that these files arern't on the net. :P

                      Sincerely,
                      Mark

                      Comment

                      • RedSon
                        Recognized Expert Expert
                        • Jan 2007
                        • 4980

                        Originally posted by markrawlingson
                        I thought about that and looked it up a couple hours ago and the concensus seems to be that you can't do it because of the way that the file system object works. I believe that will throw a "Invalid character" error.

                        Now that I think about it though I guess you could use the XML DOM to SCRAPE the contents of each of the files if you know the http://www.domain.com/foo/bar type location of the directory. You could scrape the contents, save it to a text file on the server's hard drive, and then point the FSO to that physical path.

                        But something tells me that these files arern't on the net. :P

                        Sincerely,
                        Mark
                        URL notation and the file's existence on a web server available to the internet are completely separate things. As long as you have a domain controller or active directory server in your case you can still access files on your intranet using URLs. My company's internal servers are not available to the internet but i can still get to certain things using URLs.

                        Comment

                        • NeoPa
                          Recognized Expert Moderator MVP
                          • Oct 2006
                          • 32633

                          Originally posted by RedSon
                          Here is another thing to try: when you map a drive you are basically making a short cut from \\domain\foo\ba r to X:\. So instead of doing X:\MyFileName try doing something like \\domain\foo\ba r\MyFileName. Or alternatively you can treat the file location as a URL, the various Microsoft technologies should be able to parse the \\*\*\ notation.
                          This all gets very messy!
                          You're sort of on the right lines RedSon, but remember that the whole idea of web sites is that thet're open to the world and, when accessing a site, your account tokens are not used (typically). The account IUSER_{MachineN ame} is used instead for ALL users. Typically this account does not have access rights to any of the network shares. It will be a machhine account and not even on the network. This is something that makes web development of standard internal systems such a head-ache.

                          Well, we had the problem too somewhen ago, so I HAD to figure out a way of doing it (you'll be pleased to hear). My solution is in IIS and I am certainly no expert there. I just had to get in and get my hands dirty once.

                          In IIS Manager, select the site you want this to work on and add a new Virtual Directory. I don't remember exactly the steps I used, but the "Virtual Directory" tab should be set up (as a starting point at least, you can tweak when working to your own preferences) :
                          1. A share located on another computer
                          2. Network Directory = UNC of the share (\\Server\Share ).
                          3. You must have a "special" account set up for the Connect As. Click on the button to use this account. It is a BAD idea to try to set up the IUSR_... account for this - apart from blowing your whole security system.
                          4. Script Source Access is the only checkbox not set.
                          5. Execute Permissions = None.

                          You may need to get a Domain Administrator to set this up for you. You will need to be able to assure them that your code logic fully handles security in such a way as to ensure that opening up this hole will only grant access to your system and there are no loopholes for anyone to slip through. Security is not a trivial aspect and what you're trying to do here is, by it's very nature, adding to its complexity (bad thing). Keep the variation from the norm to an absolute minimum (otherwise resolving problems later will be very difficult).

                          Comment

                          • NeoPa
                            Recognized Expert Moderator MVP
                            • Oct 2006
                            • 32633

                            Originally posted by RedSon
                            URL notation and the file's existence on a web server available to the internet are completely separate things. As long as you have a domain controller or active directory server in your case you can still access files on your intranet using URLs. My company's internal servers are not available to the internet but i can still get to certain things using URLs.
                            Except in situations where the default security is mucked up (people do because they find the whole concept so confusing) these files are only available to a user via the windows based interfaces. The web interface is generally set as a "current machine only" system. This is supporting what you're saying RedSon if I understand you correctly ;)

                            Comment

                            • mbatestblrock
                              New Member
                              • Sep 2007
                              • 164

                              Originally posted by NeoPa
                              This all gets very messy!
                              You're sort of on the right lines RedSon, but remember that the whole idea of web sites is that thet're open to the world and, when accessing a site, your account tokens are not used (typically). The account IUSER_{MachineN ame} is used instead for ALL users. Typically this account does not have access rights to any of the network shares. It will be a machhine account and not even on the network. This is something that makes web development of standard internal systems such a head-ache.

                              Well, we had the problem too somewhen ago, so I HAD to figure out a way of doing it (you'll be pleased to hear). My solution is in IIS and I am certainly no expert there. I just had to get in and get my hands dirty once.

                              In IIS Manager, select the site you want this to work on and add a new Virtual Directory. I don't remember exactly the steps I used, but the "Virtual Directory" tab should be set up (as a starting point at least, you can tweak when working to your own preferences) :
                              1. A share located on another computer
                              2. Network Directory = UNC of the share (\\Server\Share ).
                              3. You must have a "special" account set up for the Connect As. Click on the button to use this account. It is a BAD idea to try to set up the IUSR_... account for this - apart from blowing your whole security system.
                              4. Script Source Access is the only checkbox not set.
                              5. Execute Permissions = None.

                              You may need to get a Domain Administrator to set this up for you. You will need to be able to assure them that your code logic fully handles security in such a way as to ensure that opening up this hole will only grant access to your system and there are no loopholes for anyone to slip through. Security is not a trivial aspect and what you're trying to do here is, by it's very nature, adding to its complexity (bad thing). Keep the variation from the norm to an absolute minimum (otherwise resolving problems later will be very difficult).

                              That seemed to do the trick.. only, there is other files inside this directory... I guess I should have thought of that before. It throws off the result.. these files are brought in via ftp and the script is run on a scheduler to do it every hour.. I simply added the destination to my folder in my root IIS directory that will now hold these text files. So problem is solved, they are being copied in there every hour now.


                              Everything seems to be working just great.. This could have never happened without all of your guys' help. So seriously thank you

                              this had made me realize I should really learn ASP. I have a general question.. Could this same stuff be done using php? I have told myself I REALLY need to learn one of these languages.. any input on which one you guys feel is the better of the two?

                              Comment

                              • markrawlingson
                                Recognized Expert Contributor
                                • Aug 2007
                                • 346

                                Originally posted by NeoPa
                                Except in situations where the default security is mucked up (people do because they find the whole concept so confusing) these files are only available to a user via the windows based interfaces. The web interface is generally set as a "current machine only" system. This is supporting what you're saying RedSon if I understand you correctly ;)
                                Well, I just did some testing and RedSon might be right about the \\domain\\foo\b ar was of referencing it through the FSO - but i'm not sure because of the way I did this.. so i'll explain...

                                I just mapped a folder on my server's drive to a network drive. So basically C:\whatever\wha tever is now mapped as X:\domain\folde r\whatever\what ever OR \\domain\folder \whatever\whate ver

                                I tried referencing this drive with a physical path ("X:\domain\fol der\whatever\wh atever") and it gave me Path Not Found.

                                I then tried what RedSon suggested using its network path ("\\domain\fold er\whatever\wha tever") and the script works.

                                What I'm unsure about is whether it works because it's a drive on the server mapped as a network drive to the server or not (it's basically mapped to itself). I think it should work - either way it's still a network drive though, right?

                                I had also been under the impression that the FileSystemObjec t in asp can only be passed a physical path which has to start with a drive letter - but this obviously proves that theory wrong - as well as my numerous findings on google related to the subject.

                                Sincerely,
                                Mark

                                Comment

                                Working...