Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Asp Chat Help?

This is a discussion on Asp Chat Help?, within the ASP/.NET section. This forum and the thread "Asp Chat Help?" are both part of the Programming Your Website category.

 
Reply to this topicStart new topic
> Asp Chat Help?
crackafaza
post Jun 23 2008, 03:40 AM
Post #1


Squeezing
***

Group: Members
Posts: 65
Joined: 13-March 08
Member No.: 200



Hi all,

I have a website where ASP is being run, and I have an error which reads:

Microsoft VBScript runtime error '800a0046'


Permission denied /chat/message_GetID.asp, line 41

As I don't have any clue about using ASP this has become a difficult task to complete. This code is for an instant messaging chat system, but this error comes up when you click on the online user to chat to them. Could someone please advise me because this is urgent.

Thanks
Craig biggrin.gif

This post has been edited by crackafaza: Jun 23 2008, 03:40 AM
Go to the top of the page
 
+Quote Post
Rakuli
post Jun 23 2008, 04:11 AM
Post #2


Squeeze Machine
*****

Group: Administrators
Posts: 643
Joined: 13-February 08
From: Catching the squeezed drips downunder.
Member No.: 13



I don't know much about ASP at all but this seems to be a file/folder permissions issue.

The folder where the chat messages are stored (ROOT/chat/), change the permissions on this folder so "EVERYONE" has full read, write and modify abilities.


--------------------
Luke Dingle . com

Turn Over a Playful Leaf on Web Design -- read about the javascript cat
Go to the top of the page
 
+Quote Post
Antti
post Jun 23 2008, 04:19 AM
Post #3


Rapid Squeezer
****

Group: Advisors
Posts: 275
Joined: 15-February 08
From: Finland
Member No.: 139



Yes, that's probably a file/folder permission errror. There's probably some save/create/open file code on that line so check that line and tell us what it says or you can check the path of the file operation and then make sure IUSR(?) has permissions for that folder/file.


--------------------
anttisimonen.com - .NET developer

anttis.wordpress.com - Blog
Go to the top of the page
 
+Quote Post
crackafaza
post Jun 23 2008, 04:28 AM
Post #4


Squeezing
***

Group: Members
Posts: 65
Joined: 13-March 08
Member No.: 200



Ok thanks for the reply.

This is the problem thought, when I go to change the permissions on the folder on the server it says:

'This server does not support changing permissions'

But this is very odd, as I use this server for every other website, and they allow permissions.

OK, so find the code below to the whole code, find the bold piece of text the line number where it says the error occurs.

CODE
<%@LANGUAGE="VBSCRIPT"%>
<%
'1st get the name of the person you want to send message to, then pass it to the message.asp

strIMTo = request.querystring("IMTo")
strUserName = request.cookies("AuthCode")("UserName")
'Session.LCID = 1033
strNow = now()

strNewMessage = request.querystring("new")
    If strNewMessage = "true" then
        strNewMessage = "new=true&"
    else
        strNewMessage = ""
    end if
    
chatName1 = strUserName & "---" & strIMTo
chatName2 = strIMTo & "---" & strUserName

%>
<!-- #include virtual="/routines/stats.asp" -->
<%
call AddToStats(strUserName,strIMTo,"Chat")


function deleteOldControlAndChatFiles() 'delete over 30 secs old if not refreshed
    
    'on error resume next
    
    controlPath = "d:\inetpub\wwwroot\date42\data\control"
    
    Set fs = server.CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder(controlPath)
    Set fc = f.Files
    
        For Each f1 in fc
    
            If DateDiff("s", f1.DateLastModified, Now) > 30 then
        
                strTextFileName = f1.name
                [b]fs.DeleteFile (f1) 'deletes the file in the control folder[/b]
        
                chatPath = "d:\inetpub\wwwroot\date42\data\chat" & strTextFileName
        
                 'find if the file exists then delete it from the chat folder
                Set FSO = Server.CreateObject("Scripting.FileSystemObject")
                    If FSO.FileExists(chatPath) Then
                        FSO.DeleteFile (chatPath)'   ... file exists ...
                        'response.write chatPath
                    End If
                Set FSO = nothing
                    
            End if
        Next
        
    set fs = nothing
    set f = nothing
    set fc = nothing
    
End Function



Function GetThreadID
    '1st see if the chat file exsist, if yes open it
    'If not, create one
    
    on error resume next
    
    controlPath = "d:\inetpub\wwwroot\date42\data\control"
    chatPath = "d:\inetpub\wwwroot\date42\data\chat"
    
    
        
        'find if the chat file exists
        Set FSO = Server.CreateObject("Scripting.FileSystemObject")
                    
                    'Set the flag to "" 1st
                    varFlag = ""
                    
                    'test for if the 2 chat files already exist (name option 1)
                    If FSO.FileExists(controlPath & "/" & chatName1 & ".txt") then
                        varFlag = 1
                    end if
                    If FSO.FileExists(chatPath & "/" & chatName1 & ".txt") then
                        varFlag = 2
                    end if
                    If FSO.FileExists(chatPath & "/" & chatName1 & ".txt") AND FSO.FileExists(controlPath & "/" & chatName1 & ".txt") then
                        varFlag = 3
                    end if
                    
                    'test for if the 2 chat files already exist (name option 2)
                    If FSO.FileExists(controlPath & "/" & chatName2 & ".txt") then
                        varFlag = 4
                    end if
                    If FSO.FileExists(chatPath & "/" & chatName2 & ".txt") then
                        varFlag = 5
                    end if
                    If FSO.FileExists(chatPath & "/" & chatName2 & ".txt") AND FSO.FileExists(controlPath & "/" & chatName2 & ".txt") then
                        varFlag = 6
                    end if
                    
        Set FSO = nothing
        
                        
Select Case varFlag
    
    Case "" 'none exists, so create both chat files
    
            'create the control file 1st
                
                Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
        
                'Create the text file
                Set objTS = objFSO.CreateTextFile(controlPath & "/" & chatName1 & ".txt")
        
                'Write to the file
                objTS.WriteLine(strUserName & "3")
                objTS.WriteLine(strIMTo & "3")
                    
                'Clean up!
                objTS.Close
                Set objTS = Nothing
                Set objFSO = Nothing
                            
                    'now create the chat file with the same name
                    
                    Set objFSO2 = Server.CreateObject("Scripting.FileSystemObject")
            
                    'Create the text file
                    Set objTS2 = objFSO2.CreateTextFile(chatPath & "/" & chatName1 & ".txt")
            
                    'Write to the file
                    'objTS2.WriteLine("Never give out your password or credit card number in an instant message conversation. ")
                    'objTS2.WriteLine("Warning:- ")
                        objTS2.WriteLine(" ")
                    'Clean up!
                    objTS2.Close
                    Set objTS2 = Nothing
                    Set objFSO2= Nothing
                    
                    response.redirect "message.asp?" &  strNewMessage  & "IMThreadID=" & chatName1 & "&IMTo=" & strIMTo
                    
    Case "1" 'the control file exists (opt1) create the chat file
    
        'now create the chat file with the same name
                    
                    Set objFSO2 = Server.CreateObject("Scripting.FileSystemObject")
            
                    'Create the text file
                    Set objTS2 = objFSO2.CreateTextFile(chatPath & "/" & chatName1 & ".txt")
            
                    'Write to the file
                    'objTS2.WriteLine("Never give out your password or credit card number in an instant message conversation. ")
                    'objTS2.WriteLine("Warning:- ")
                        objTS2.WriteLine(" ")
                    'Clean up!
                    objTS2.Close
                    Set objTS2 = Nothing
                    Set objFSO2= Nothing
                    
                    response.redirect "message.asp?" &  strNewMessage  & "IMThreadID=" & chatName1 & "&IMTo=" & strIMTo
                    
    Case "2" 'the chat file exists (opt1) create the control file
    
        'create the control file 1st
                
                Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
        
                'Create the text file
                Set objTS = objFSO.CreateTextFile(controlPath & "/" & chatName1 & ".txt")
        
                'Write to the file
                objTS.WriteLine(strUserName & "3")
                objTS.WriteLine(strIMTo & "3")
                    
                'Clean up!
                objTS.Close
                Set objTS = Nothing
                Set objFSO = Nothing
                
                response.redirect "message.asp?" &  strNewMessage  & "IMThreadID=" & chatName1 & "&IMTo=" & strIMTo
                
    Case "3" 'both files exists (opt1)
    
        response.redirect "message.asp?" &  strNewMessage  & "IMThreadID=" & chatName1 & "&IMTo=" & strIMTo
        
        
    Case "4" 'the control file exists (opt2)  create the chat file
        
        'now create the chat file with the same name
                    
                    Set objFSO2 = Server.CreateObject("Scripting.FileSystemObject")
            
                    'Create the text file
                    Set objTS2 = objFSO2.CreateTextFile(chatPath & "/" & chatName2 & ".txt")
            
                    'Write to the file
                    'objTS2.WriteLine("Never give out your password or credit card number in an instant message conversation. ")
                    'objTS2.WriteLine("Warning:- ")
                        objTS2.WriteLine(" ")
                    'Clean up!
                    objTS2.Close
                    Set objTS2 = Nothing
                    Set objFSO2= Nothing
                    
                    response.redirect "message.asp?" &  strNewMessage  & "IMThreadID=" & chatName2 & "&IMTo=" & strIMTo
                
    Case "5" 'the chat file exists (opt2)  create the control file
        
        'create the control file 1st
                
                Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
        
                'Create the text file
                Set objTS = objFSO.CreateTextFile(controlPath & "/" & chatName2 & ".txt")
        
                'Write to the file
                objTS.WriteLine(strIMTo & "3")
                objTS.WriteLine(strUserName & "3")
                    
                'Clean up!
                objTS.Close
                Set objTS = Nothing
                Set objFSO = Nothing
                
                response.redirect "message.asp?" &  strNewMessage  & "IMThreadID=" & chatName2 & "&IMTo=" & strIMTo
                
    Case "6" 'both files exists (opt2)
    
        response.redirect "message.asp?" &  strNewMessage  & "IMThreadID=" & chatName2 & "&IMTo=" & strIMTo
        
End Select            
                    
                    
    
        

End function



Call deleteOldControlAndChatFiles '1st step
Call GetThreadID

%>
Go to the top of the page
 
+Quote Post
crackafaza
post Jun 23 2008, 04:29 AM
Post #5


Squeezing
***

Group: Members
Posts: 65
Joined: 13-March 08
Member No.: 200



Ok, so it didn't change the line to bold, so if you search for..

fs.DeleteFile (f1) 'deletes the file in the control folder

That is where the code line error is occuring.
Go to the top of the page
 
+Quote Post
Rakuli
post Jun 23 2008, 05:05 AM
Post #6


Squeeze Machine
*****

Group: Administrators
Posts: 643
Joined: 13-February 08
From: Catching the squeezed drips downunder.
Member No.: 13



Are you able to change the user this script is running as to an administrator? It's clear from that line that this is a permissions problem.

Also, are you running under administrator? This may be why you can't change the permissions? (Sorry, grasping at ASP straws here)


--------------------
Luke Dingle . com

Turn Over a Playful Leaf on Web Design -- read about the javascript cat
Go to the top of the page
 
+Quote Post
crackafaza
post Jun 23 2008, 05:07 AM
Post #7


Squeezing
***

Group: Members
Posts: 65
Joined: 13-March 08
Member No.: 200



Hi,

Thanks for your reply Rakuli, after playing around with the permissions and the code, I found an answer with just guessing, it was as simple as to delete the code that read:

fs.DeleteFile (f1) 'deletes the file in the control folder

And then it worked fine!
Go to the top of the page
 
+Quote Post
Antti
post Jun 23 2008, 05:32 AM
Post #8


Rapid Squeezer
****

Group: Advisors
Posts: 275
Joined: 15-February 08
From: Finland
Member No.: 139



If you just removed that line from the code then you may experience some problems since like it says it deletes a file in control folder. If you don't delete that file, it may cause some problems. I don't know if it will since I'm not familiar with the whole chat system but the real answer is to set the permissions and NOt changing the script.


--------------------
anttisimonen.com - .NET developer

anttis.wordpress.com - Blog
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   2 minute44 120 23rd April 2008 - 11:26 AM
Last post by: delusion
No new   66 Jacob 1,196 10th November 2008 - 07:21 PM
Last post by: Jacob