ASP File Permissions - asp-classic

I'm a ASP.NET developer who was contacted by a client asking me to make some changes to their site after someone told them it was ASP.NET. It wasn't, it was classic ASP but she seemed at her wits end with it so I said I would give it a go. However I have very little experience with Classic ASP.
Am currently trying to update a form. Have copied the entire site and database to my local machine and got it up and running. I have set the Anonymous user to my windows user to allow me to connect to the database using windows authentication.
The difficulty I am having is when I go to edit an existing record using the edit form and click save on my local machine I get the following error:
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/xtpropertyedit.asp, line 200
800401f3
However it works fine on the hosted version of the site. I imagine this is an permissions issue. I have tried adding my user with full permissions to the root folder of the site on my local machine but that doesn't seem to make a difference.
Set Jpeg = Server.CreateObject("Persits.Jpeg") '** Line 200 **
Any ideas?

AspJpeg is a paid third-party component and seems like it's not installed on your development computer. It can be used without any limitation for 30 days.

Related

The parameter 'exePath' is invalid

I am trying to setup a website on IIS. It is basically a copy of an existing website (working) that we have that is hosted on another server. The two server's OS is running the same OS Windows Server 2003 and both site is running on IIS 6. The source code is the same since it was just copied from Site A. Only difference is that the database is now connected to a new database.
When I open a page on the site, it throws me this error.
The parameter 'exePath' is invalid
Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary
ASP.NET Files\fias\576e43ba\53e00dbc\App_Web_bndnkzt8.0.cs Line: 0
I am not sure what is causing this. But I am sure that it is not on the code since it's just copied from the other working site.
I am looking into permissions on directory. I already changed permissions to say FULL Control but that doesn't seem to fix it.
Anyone has any idea on how to solve this?
Thanks in advance!!!

HTTP/1.1 500 Server Error With ASP classic

At the very outset I would like to state that this is my first ASP classic page that I have created which since the first deployment on IIS is giving me server 500 error. I have searched the entire web and have done almost everything possible to get this right, but all in vain.
I have created a classic ASP page using Web Matrix. This is a web based dashboard which connects to MSSQL server and fetch necessary information. I have a similar app in php which is working perfect, but I wanted to learn ASP hence was trying to make a similar web app on ASP. This app works absolutely fine on Web Matrix. When I run this app from within web matrix (both on chrome as well as IE) it connects to the required database and I can browse the details as expected. The problem starts when I host this on IIS (localhost on my windows 7 pc). This is the exact procedure that I have followed :
Created a new Site on IIS named "YCube"
Using basic settings I have given the following Physical path for the app (D:\YVXS\Personal\ASP\SSTool\Ycube) {the project output folder}
In the bindings page I have assigned port 81
IIS authentication is set to "Anonymous Auth"
Application pool for asp is set to classic (as IIS first stated it cannot perform the task in integrated mode)
After this when I tried browsing localhost:81/menu.asp, it given me server 500 error. The 21 days research starts now (bullet points below)
To get the descreptive errors on the web page I did following but the error description did not change IIS->asp->Compliation->send error to browser =true, friendly http error on IE = disabled
IIS log files, not sure if iam not able to understand the error but am getting follwing on the log file (C:\inetpub\logs\LogFiles\W3SVC1
2013-02-23 08:07:44 ::1 GET /menu.asp |-|ASP_0147|500_Server_Error 80 - ::1
On the IIS forum only I underatood at time global.asa file can cause this problem, I deleted this file and tried, all in vain
The folder and files permission for my site is read only, however I have tried the same with read and write access also, this also did not help
On the error pages in IIS, i have changed the "Edit feature settins" to "Detailed error", this also didnot give me any futher error desc.
24 times i have uninstalled IIS and installed back, nothing has happend
Someone suggested to created a dummy asp file and try hosting the same of IIS, so I used a small code
<HTML> <BODY> This page was last refreshed on <%= Now() %>. </BODY> </HTML>,
this is giving correct output (This page was last refreshed at 18:88:22....), however with my original asp page I still get server 500 error
A friend of mine suggested to delete all other hosted web pages from IIS and try (I had one PHP on the IIS), hence I deleted the same and tried, no changes at all
Event log file is showing nothing pertaining the ASP (only few files are there which tells about unexpected shutdown of my PC)
I created a second ASP file which had MS access at the backed, this only is also giving me same server 500 error
Other things that I have tried is changing the web.config file to send detailed error, (thouh i forgot the exact line) but that also did not help me
Here are my system config and other details Windows 7 professional, IIS7.5.7600, MSSQLR2express. Also please note that I have tried hosting this on two othe pc's that I have(both windows 7) and in office server 2003, but all are giving me same server 500 error.
Never thought learning a classic asp will put me into all this Jazz...please help..
Couple of Things u need to take care of while configuring ASP site in IIS
1) Enable parent path = true
2) if you have 64 bit machine need to set your Application pool for 32 bit.
this are default settings which we need to take care.

asp.net FileUpload control problem: access to directory is denied

Im trying to use the fileupload control. Im using Visual Web Developer Express on my desktop.
My web application is working fine except I cant use the fileUpload control. I get the following error:
ERROR: Access to the path (My_Directory) is denied
I searched and it appears to be a permissions problem. So I attempted to add the user ASPNET and give appropriate permissions to the directory, however, I was unable to add user "ASPNET". User "ASPNET" was not found.
So then I followed the following directions to add user ASPNET via Control Panel > Administration > Computer management. So now I was able to add user ASPNET to the directory and give appropriate permissions but I still got the above error.
http://p2p.wrox.com/net-web-services/5918-creating-aspnet-user.html
Any ideas on why I cant access the directory?
If you're using Vista/Windows 7/Win2003/Win2008, the user you need is the Network Service account. You can verify by seeing what user your application pool is running under.
Grant the proper permissions to that account (if indeed it's the account that your application pool is running under) and you'll be golden. Note also that with Windows 7 and Win2008, the default account could be the ApplicationPoolIdentity, which you can find out more information about at http://forums.iis.net/t/1156692.aspx. Regardless, you can simply switch the account that your application pool is running under to the Network Service account to verify that that is the issue.
Ever figure this out? If you're overwriting files check to make sure they aren't set to read-only.
I've handled these permissions plenty before and had tried everything in the book and on this site and others (I'm on Win7, IIS7.5 also). Sometimes it's the silly little things...

What user does classic asp run as?

I have an asp page that saves a file to disk.
Currently it works locally, but I need to save the file to a share and I get permission denied.
I had assumed I could just set the app pool to the user that has access to the folder, but it doesn't seem to work.
How do you make classic asp run as a specific user?
I believe that by default classic asp will run under the iis user which is IUSR_MachineName. This can be changed in the IIS Manager.
Good references:
http://kb2.adobe.com/cps/153/tn_15378.html
http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=287
IIS Admin - Website Properties - Directory Security - Edit...
By default it's IUSR_MACHINENAME
Look at who is running the following:
"inetinfo.exe" process
"World Wide Web Publishing service"
It should be one of those I believe.
Is the program attempting to go to a share on another computer (or this computer), or a folder on the web server which happens to also be a share? When you access it through the \\server\share notation, you are going to have different issues than through the local drive driveletter:\folder\ notation.
If it is a share on another computer, the account will need to have rights to the share as well as rights to the underlying files and must be a domain account.
It depends on what you are actually doing but you would probably want to avoid giving the whole application a user identity that has network access just to service the needs of this one file.
You can configure in IIS the user identity for anonymous access on that one ASP file, that would be better than setting it for the whole application.
Another option in the intranet environment is to turn off anonymous access for the ASP file and turn on windows integrated access. The clients user account is used for the security context for running the ASP and any subsequent network access it might make.
I've encountered a similar problem : Unable to Execute Bat EXE or CMD.exe from classic ASP pages on IIS 7.
As I have found a solution, I HOPE it will help the folks to save time !
For a solution look there : (I've Marked the very last post as Answer).
http://forums.iis.net/t/1193937.aspx/1?+BAT+and+vbs+Files+does+not+run+anymore+from+Classic+ASP+was+running+on+Win+2003+Server+
Have a great starting 2013 !

SharePoint 2007 Remote File Access Denied CAS

I have code running in an ascx within PageLayout within SharePoint 2007 that accesses files on a remote server i.e. File.Create("\servername\sharename\folder\file.txt"). The code runs within a SharePoint web application that has CAS trust set to Full in the web.config. The File.Create throws the following exception:-
System.UnauthorizedAccessException
Access to the path '\\servername\sharename\folder\file.txt' is denied.
The share is shared to Everyone with Full Control and the NTFS permissions are set to Everyone with Full Control. The web application app pool is running under a domain account also with explicit permissions to access that resource (not that this should be needed).
I ran Process Monitor on the remote machine and no hits were being recorded on the server. This leads me to believe that it is an issue with the SharePoint Code Access Security settings. Like I've said above, the trust in the web.config is set to Full.
Is it possible that CAS is still blocking the remote access? Can anyone think of any other area to review?
Update
A bit more information...
I've tried making the app pool acct domain admin and the problem still occurs. When using the same method to access a drive on the local machine it works fine. Running the same code in SnippetCompiler outside of sharepoint using the app pool account works fine.
Hope this helps, let me know if you can think of any more avenues of investigation or tests I can try.
Update
Im not sure if this would affect the issue but the local server is running Windows Server 2003 and the remote server is running Windows 2000.
Update
I've just tried running the code through a web part and it works fine. The file structure I use in the project that is failing is as follows:-
wss
- VirtualDirectories
- SharePointWebApp
- ...sp web app files
- .
- .
- PageLayoutControls
- control.ascx
- .
- .
Then in IIS I have the following structure:-
IIS
- Websites
- SharePointWebApp (pointing to \wss\VirtualDirectories\SharePointWebApp)
- PageLayoutControls (virtual directory pointing to \wss\VirtualDirectories\PageLayoutControls)
Then within the PageLayouts I reference the controls using the following:-
<%# Register TagPrefix="TEST" TagName="MyControl" Src="~/PageLayoutControls/control.ascx" %>
<asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
<TEST:MyControl id="myControl" runat="server"/>
</asp:Content>Let me know if you need more info.
Update
The mystery deepens...
When I access the sharepoint site from Internet Explorer (6 or 7) on the SharePoint web front end server I do NOT get the exception.
When I access the sharepoint site from Mozilla Firefox from the SP web front end server I DO get the exception.
When I access the sharepoint site remotely from ANY browser I get the exception.
Also, it makes no difference what user I use to log on to the site, as long as they have permissions to access the sharepoint site.
Any thoughts?
Update
Hmm, I've now found that if I access the sharepoint site remotely and the sharepoint site tries to do a File.Create() locally (i.e. File.Create("C:\temp\abc.txt")) then it works. If I access the sharepoint site from the sharepoint box and do a File.Create() remotely (i.e. File.Create("\ServerName\ShareName\FolderName\file.txt")) then it works.
It only fails when I access the sharepoint site remotely and have the sharepoint site try to do a File.Create() remotely as well. Kind of a double hop problem. This makes me think it may be an NTLM / Kerberos issue.
Currently, we are running using NTLM authentication.
Has anyone else experienced this sort of issue?
Update
Yep, I'm pretty sure this is an NTLM issue not allowing a double hop. I just changed the authentication on the sharepoint site to use Basic Authentication and its worked. Changed it back to Integrated Authentication and it failed.
Now to decide whether to move the farm to use Kerberos or find another way around the issue. :-/
Update
Just giving SPSecurity.RunWithElevatedPrivileges a shot now. One thing though, is RunWithElevatedPrivileges meant to be used in this context? Previously, I've only used it to get access to lists and libraries within SharePoint rather than accessing a file access the network.
Any thoughts?
Update
Yep, SPSecurity.RunWithElevatedPrivileges resolves the issue. :-)
I wonder if this is the double-hop issue and that your code is trying to access the resource as the impersonated user, but that fails because NTLM will not impersonate to another server (Kerberos would).
Have you tried SPSecurity.RunWithElevatedPrivileges? That would remove the impersonation (RevertToSelf) and then maybe the application pool owner can just act as himself (herself?) whereas maybe it couldn't before.
Just a thought and should be pretty easy to try out.

Resources