I have the following code:
<%
dim deviceid
dim fso
dim outFile
deviceid=Request.QueryString("deviceid")
If deviceid<>"" Then
Response.Write("Hello " & deviceid & "!<br>")
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("C:\Users\Victor\Desktop\respTank.txt")
outFile.WriteLine("Hello World!")
outFile.close
set outFile = nothing
set fso = nothing
End If
%>
I get the following error:
Microsoft VBScript runtime error '800a0046'
Permission denied
I gave all permissions to IIS_IUSRS but it didn't help. Can anyone help me here?
It sounds like the ApplicationPoolIdentity is not the user context being used by the Web Application.
Depending on the IIS Version, you want to check (using the Manager)
IIS 4-6
Web Site / Application Properties -> Document Security
IIS 7+
Web Site / Application -> Authentication
and check the Anonymous Account which can be set differently to the ApplicationPoolIdentity.
Based on this value apply the permissions (at least Modify) to the folder C:\Users\Victor\Desktop\ and you are good to go.
I just had the same thing happening on a delete file, have you tried removing the parenthesis?
Set outFile = fso.CreateTextFile("C:\Users\Victor\Desktop\respTank.txt")
to
Set outFile = fso.CreateTextFile "C:\Users\Victor\Desktop\respTank.txt"
Related
I want to call an executable file from a web application hosted within IIS 10.
When I run my application locally with IIS Express everything works fine, but after deploying on the production server, I only get the exit code -1073741819.
On the product server I gave full rights for the user of the application pool in the folder, where the exe file is located, but that did not work as well.
Do I have to set other, special rights to the user?
This is my code ...
ProcessStartInfo procStartInfo = new ProcessStartInfo(libreExecutable.FullName, argument);
procStartInfo.CreateNoWindow = true;
procStartInfo.UseShellExecute = false;
procStartInfo.WorkingDirectory = workingDirectory;
procStartInfo.RedirectStandardInput = true;
procStartInfo.RedirectStandardOutput = true;
procStartInfo.RedirectStandardError = true;
// This is empty with code -1073741819
process.StandardError.ReadToEnd();
-1073741819 is 0xC0000005, that means ERROR_ACCESS_DENIED. IIS doesn't have permission to call the .exe file.
I gave full rights for the user of the application pool in the folder
I don't know how you do. But it is better to add IIS APPPOOL\pool name in folder security property and set it full control permission.
If it still report this error, please try to change the application pool identity. Administrator has the highest authority, try to change identity to administrator.
I want to change permission of created DL folder in liferay through java class: let us consider foldername id "temp"
You need to get the folder 'temp':
Folder tempFolder = dlAppLocalService.getFolder(groupId, parentFolderId, "temp");
and you have to set the permisssions for the 'tempFolder' resource.
For instance, if you want to set VIEW permission to GUEST role:
Role guestRole = roleLocalService.getRole(companyId, RoleConstants.GUEST);
resourcePermissionLocalService.setResourcePermissions(companyId, DLFolder.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(tempFolder.getFolderId()), guestRole.getRoleId(), new String[]{"VIEW"});
You can see the complete API here
https://docs.liferay.com/portal/6.2/javadocs/com/liferay/portal/service/ResourcePermissionLocalServiceUtil.html
Best regards
You can use ResourcePermissionLocalServiceUtil service to give permission to your DlFolder as below :
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId,DLFolder.
class.getName(),ResourceConstants.SCOPE_INDIVIDUAL,""+
folder.getFolderId(), roleId, permissions);
Fins details on it from here!
I have Classic ASP 2 websites on an Windows 2008 IIS 7 install. website1.com and website2.com. Both are serving the same website from one folder: C:\Webs\website\
website1.com has been in operation for 6 years and in the app it can write files to a network share; \wdc\SharedFiles\assets\docs\
All the proper permissions are set as it has been reading and writing files for years.
I recently added website2.com. The website is serving from the same diretory. I need it to be able to write to that same share. The problem is, website2.com gets "Write to file failed." and "Permission Denied" errors.
How is this possible?
I even mocked up a simple test. Same error.:
Dim fso, objFile
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set objFile=fso.CreateTextFile("\\wdc\SharedFiles\assets\docs\test.txt")
objFile.WriteLine("hello this is test")
objFile.Close
Set objFile=Nothing
Set fso=Nothing
Any ideas? I am pulling my hair out.
I figured this out on my own. So others can benefit, here it is:
In IIS go to the website (website2.com) node, then select "Authentication".
Make sure "Anonymous Authentication" is enabled and set it to a user.
Then with the Explorer give that user read-and-write access to the share.
Not sure if this will make a difference. The only difference in my code, really, is that I'm using server.mapPath to specify path.
path = Server.MapPath ("\")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateTextFile(path & "\" & txtFileName, 2) '2 = for Writing
f.Write(txtFileContents)
f.close
set f=nothing
I've got the following code working as VBScript from command line:
Set FRELoader = Server.CreateObject( "FREngineWrap.FRELoader" )
Set Engine = FRELoader.Load
When I put it into ASP page:
<%# Language=VBScript %>
<%
Set FRELoader = Server.CreateObject( "FREngineWrap.FRELoader" )
Set Engine = FRELoader.Load
%>
it doesn't work:
Error Type:
(0x80004005)
Unspecified error
/test.asp, line 4
I've got IIS 5.1 here
The problem is definitely in FREngineWrap.FRELoader, not in your ASP code. Remember, when running from VBScript, the program runs in your user context - e.g. as user "MYDOMAIN\alex347".
When you run the program from ASP, it runs in whatever IIS security context you are using. This often can cause problems, especially if the IIS user doesn't have access to files you have access to as MYDOMAIN\alex347.
If you have the source code to FRELoader, you might check and see where it throws an error. Otherwise, you might have to try changing your IIS security settings.
EDIT: Here's a link for how to modify IIS so that it uses a different user's credentials. Try changing IIS's credentials to your username and see if it works.
http://technet.microsoft.com/en-us/library/cc730708(v=ws.10)
That is a database connection error. Check your connection string.
I have to run command line operation from some legacy ASP application.
Here is my code:
<%
cmd = "%comspec% /c echo Hello"
set wsh = CreateObject("WScript.Shell")
ireturn = wsh.Run(cmd, 0, true)
set wsh = nothing
%>
And here is result I am receiving:
Microsoft VBScript runtime error
'800a0046'
Permission denied
/test.asp, line 6
Do you have any idea how to make IIS6 to run this code?
Note: Of course I don't have to run echo command but I want to exclude any additional causes of the problem.
Update: I tried most things tomalaks mention however nothing helped. Maybe I can alter question a little. How can I debug this problem?
ASP usually is denied access to anything potentially dangerous, such as cmd.exe. Check file permissions on cmd.exe to see if that is true for you (I suppose it is).
If you really must use cmd.exe to do part of the page processing, either change file permissions on cmd.exe (not recommended for an Internet-facing web-server), or make sure that the ASP page runs credentials that are not denied access to that file.
To achieve this, use the IIS management console to remove "anonymous access" to the ASP page and use Windows-integrated authentication instead (if feasible), or leave "anonymous access" on and enter a fixed set of credentials that should be used instead of the default "IUSR_...".
Alternatively, if you use cmd.exe just to start a program that outputs something to STDOUT, you can try starting the program directly, without wrapping it in a cmd.exe call. Again, the user the ASP page runs under needs access to that program's executable.