if i save my webpage as html it is giving me the error:
Access for the path C:\ is denied -ftp.
in http locally it is working. it is storing in the desktop. but after publishing in ftp server it is showing this error
how to resolve this errror
on Windows 7? you can turn off UAC.
Below, I assume that the web application is not allowed to save data to the hard drive.
Make sure that the process running the worker process for IIS has write permission for that folder. However, it is unusual to save files in C:\, and usually a web application should use a database server to store new data. If you deploy your web site to a hosting server, you might not be allowed to save data on the hdd of the server.
Related
I have an input MDB file coming from a third party program. I have to read it in my asp .net application and then ask some related form to the final user.
At the moment, I can write the mdb file on the filesystem and read it, it works but sometimes this feature doesn't work and I have to restart the server.
The customer want to externalize the server and I can't write to the file system or even restart it so I'd like to read the mdb file in asp .net from a MemoryStream or maybe execute a conversion to a most readable format like XML, but I don't think it is possible.
So I'm looking for a solution to preprocess the access file.
I don't think it is possible to read it via javascript (only vbscript).
The only way I imagined is :
call a special application with a url code like app://id the id is transmitted to a special application on the desktop, he will select his file and the content will be transmitted to the web app via web service
after that the person should click on a button and he can process the different form associated with that data
that sounds me complicated for the final user
does someone have some feeling or idea about that case ?
Edit
The mdb file is uploaded via a http form contained into the web form.
Sometimes, after the upload, the application throw an exception and it can't use the c:\windows\temp. I have an error : Access not possible on the specified file.
I don't have a better information because the application is located in the internal network of the customer and I'm not there. So I have to ask them to reboot it.
Quote: Configuring Permissions for an Access Database
When a Web application uses an Access database, the application must
have Read permission to the .mdb file so the application can access
the data. Additionally, the application must have Write permission to
the folder that contains the .mdb file. Write permission is required
because Access creates an additional file that has the extension .ldb
in which it maintains information about database locks for concurrent
users. The .ldb file is created at run time. [...]
Therefore, to use an Access database in an ASP.NET Web application,
you must configure the folder that contains the Access database to
have both Read and Write permissions for the local ASPNET user
account.
In other words, if you have no permissions to read and write you will not be able to work with .mdb.
There are following options available
If permissions cannot be done due to security reasons, but your web server has an access to the .mdb file location (both located in same network) then your client could setup a scheduled job which will backup/copy .mdb to another location where asp.net could have permissions to work with .mdb. This however will be a problem for syncing backup .mdb to production .mdb.
Setup a webservice to update .mdb. It will be hosted on the server where .mdb is located and will have all required permissions. Your application will work with .mdb through the webservice and does not require any permissions on .mdb.
Replace .mdb with SQL Server Express
I have a stand-alone IIS7 Server that is not joined to a domain and that is running an simple ASP.Net application. This application has an ActiveReports report that has an image control where I set the path of the image during run time to a network share on another server. When I run the application locally in Visual Studio on a desktop that is joined to the same domain as the network share, I am able to get the images, but when I deploy the application to the stand-alone IIS server and run it locally on the IIS server I am not able to get the images. I added permissions on the network share for the username and password of the login for the IIS server and I am able to navigate using Windows Explorer to the network share from the IIS server now, but I can't get the permissions right on IIS.
What is the correct way to set the permissions so that the application can access the image files on the network share?
When IIS access network resources it uses the security context (account) associated with the IIS process. This is primarily controlled by the Application Pool unless you are doing any kind of impersonation at the code level.
In order to correct you issue you'll probably need to make sure the application pool is running using a security account that has access to the network resource. Here are some links that may help
http://technet.microsoft.com/en-us/library/cc771170(v=WS.10).aspx
http://www.iis.net/learn/manage/configuring-security/application-pool-identities
Also, don't forget, if you are using windows file services for your network share there are two levels of permissions, those that are set at a share level and those that are set at the file level if using NTFS. Here is some info:
http://technet.microsoft.com/en-us/library/cc754178.aspx
One idea: on the IIS7 server, create a Virtual Directory that points to the share. When creating a Virtual Directory, IIS will let you enter credentials needed to access a share.
Then, you'll need your image paths to reference the share.
In my application,I have to copy a whole directory to the specified location in remote servers, and now we first make the location in the remote servers shared,then copy it.
Furthermore,the location in the remote servers are all mapped to web site in iis. That's to say,each location is a web site root path in remote server,and directories copied to the server will be made as `application(vitrual directory) and deployed.
However,our clients wonder if this is security since the root of the web site location is shared?
So I wonder if there is any way we can copy files without share folder?
Check out WMI # http://msdn.microsoft.com/en-us/library/windows/desktop/aa394594(v=vs.85).aspx
You could probably create a simple Wcf Service which could be hosted by the iis on the target server and give an opportunity to upload files. I guess the security issues (authentication, ip filtering, etc.) can be considered easily enough and the permissions to write files to the server will be necessary only for the wcf service, executing locally.
I am using ASP.NET for my web application. I am able to write a text file in server path using this method Server.MapPath(). But I also want to create a text file in different location like C:\ or D:\. I am using IIS version 5.1.
This is my code to write a file in the C:\ drive.
string text="Welcome";
StreamWriter sw = new StreamWriter("C:\\sample.txt", true);
sw.WriteLine(text);
sw.Close();
When I run the application it throws a runtime exception saying
UnauthorizedAccessException. Access to Path C:\sample.txt is denied.
Please guide me how to write a text file in the C:\ drive...
Its obvious that you need permission to be able to create/write/delete etc a file on any location on disk.
The tip here is that your asp.net application is running under one pool, and the pool is running under specific user - this user must have the correct permissions.
Update
There is two kind of users that "runs" together on an asp.net page. The one have to do with permission with IIS, and this is the one that KBoek speak about. For example, a user request a page , from IIS, and the IIS using the USER A to see if can read this file and send it back to web - or have permissions to run.
The second type of user is the pool. From the moment that IIS have permissions to run the pool then run it using the pool user. So if the file is going to read by pool the pool must have permission to read and not the iis.
Why there are two kind of users here. Because the one is represent the user that see the data, and the other represent the programming that we made.
If for example we have an automation tool that make delete to a set of files, then we do not won to the remote client to direct access this file and maybe delete if he like to - but only we must have this permission to do only on programming. So our asp.net program have different permissions from the user that connect and see page, so we have two kind of users here.
The server process runs under a specific user (dependent on your IIS version), that user has to have write access to the folder where you want to save the file. Tell me your IIS version, then give me a minute and I'll look up the user name for you.
In order to write into a certain location, the web server user must have write access granted to that location. You have to set up the folder rights to this for work. The exact user depends on your IIS version.
First of all I'd use Server.Mappath("C:\\sample.txt");.
Secondly, the exception says it all, the user attempting to write a file in the server does not have the permission to write.
Check Checking and Setting up the Correct Permissions on the IIS Server for permissions
Find your user and allow it to write.
hi
I have a FileUpload and I save a picture and this is the error
Access to the path 'D:\Hosting\0000000\html\images\APgt_logo.jpg' is denied.
an my local is working well
whats the problem?
this is the code
new_row["Product_imag"] = FileUpload1.FileName.ToString();
FileUpload1.SaveAs(Server.MapPath("/images/"+ FileUpload1.FileName.ToString()));
The user that is running the Web Service process (ie w3wp.exe) doesn't have sufficient rights on the folder you are trying to write to.
Either you have to set write rights in IIS, or you have to adjust the security in the file system. Or both.
You need to provide more information if you want help with that.
This is a permissions problem on your web server.
When you run the project locally, the local web server is executing using your permissions which has write access to the directory in question.
When running on the server, the user the app pool is executing under does not have permission to write to the directory. This is normal as it usually shouldn't.
You might ask this over at serverfault.com to get some good recommendations on how to do this in a secure manner.