Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

ASP compare folders w/ authentication?

Options
  • 19-04-2007 10:01am
    #1
    Registered Users Posts: 2,835 ✭✭✭


    lads,

    I'm trying to compare two folders over a network with this code
    Function CompareFiles()
    
    	Dim oFolder1, oFolder2, oFSO
    	Dim intSize1, intSize2
    
    	Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
    	Set oFolder1 = oFSO.GetFolder("\\server\directory")
    	Set oFolder2 = oFSO.GetFolder("\\server2\directory2")
    
    	intSize1 = CDbl(oFolder1.Size)
    	intSize2 = CDbl(oFolder2.Size)
    
    	If intSize1 = intSize2 then
    		CompareFiles = True 
    	Else
    		CompareFiles = False 
    	End If
    
    	Set oFolder1 = nothing
    	Set oFolder2 = nothing
    	Set oFSO = Nothing
    
    End Function 
    

    it works fine when no authentication is needed, but you need a admin username and password to access the servers and i've tried to add them in like this but it didnt work:
    Set oFolder1 = oFSO.GetFolder("[b]username:password@[/b]\\server\directory")
    Set oFolder2 = oFSO.GetFolder("[b]username:password@[/b]\\server\directory")
    

    how can i use a username/password to access these network folders?


Comments

  • Closed Accounts Posts: 97 ✭✭koloughlin


    I'm afraid I don't know the answer to your question, but just a quick observation on the approach. It looks like you're using the size of the folder to identify changes. My concern would be that you can have changes that don't change file sizes and that wouldn't be picked up by your algorithm. For example if a user was to edit a text file, replace the word "porgramming" with the word "programming" and save the file size wouldn't change and that change wouldn't be picked up by just looking at size.


  • Registered Users Posts: 2,835 ✭✭✭StickyMcGinty


    cheers, but its comparing iso files in the folder so its only major changes would need to be picked up.

    i figured it out, had to use asp.net to do it though, now i cant even connect to the ms sql database using .net i'm so used to asp... nightmare!


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    For the ASP side of things.. are you doing this via a WebServer or running it from a client as a VBS file.

    If its a web server, you can modify your code and say it as a VBS file and then run the file as a Domain admin to have a hassle free experience.

    If you still want to run it from the WebServer, your problem is one of 2 things.

    1 .. if you are have set Annoymous Access on the website, the app will use the IUSR_<MACHINENAME>. You can change the account that the webserver uses to another domain account with access rights to the share so that it can do its stuff.

    2.. Using Windows Auth then you will have to make sure that the person running has permissions across the domain (you prolly did this use ASP.NET impersonation)



    With ASP.NET use the SQLClient to connect to a SQL database. Plenty of examples out there. (http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.aspx) (uses .NET 3.0 other versions are listed)


  • Registered Users Posts: 2,835 ✭✭✭StickyMcGinty


    Ginger wrote:
    For the ASP side of things.. are you doing this via a WebServer or running it from a client as a VBS file.

    If its a web server, you can modify your code and say it as a VBS file and then run the file as a Domain admin to have a hassle free experience.

    If you still want to run it from the WebServer, your problem is one of 2 things.

    1 .. if you are have set Annoymous Access on the website, the app will use the IUSR_<MACHINENAME>. You can change the account that the webserver uses to another domain account with access rights to the share so that it can do its stuff.

    2.. Using Windows Auth then you will have to make sure that the person running has permissions across the domain (you prolly did this use ASP.NET impersonation)



    With ASP.NET use the SQLClient to connect to a SQL database. Plenty of examples out there. (http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.aspx) (uses .NET 3.0 other versions are listed)

    cheers for the input. when writing this tool i've had to learn ASP in a week and now it looks like i've to learn ASP.NET in as short a time :(

    i've used "impersonate user" in ASP.net in the Web.config file and edited the classic ASP code to fit, i couldnt connect ot the SQL server DB at all so i've decided to pass values from the previous page as ASP.NET provides more fun with forms :(


Advertisement