can not change folder permission during installation - asp.net

i know that people couldn't say that this is trivial, but i have search for days in internet and can not be able to do this.
i am using visual studio 2010 ultimate and have created my setup with setup and deployment of vs 2010.the problem is that i have an application folder which contains my database and which is deployed with my application. When i deploy it in administrator part of computer, all is correct, i devined that it is due to fullcontrol permission of administrator programfiles folder.But when i deploy it in another account, application don't has access to database for writting. i looked for the web site and understood that this is due to programfiles folder permission for others users.So i decide to do another research in order to give more rights to users for this folder.
I finally understood that i can achieve this with authoring tools like robocopy by using custom action or with a command line by just correctly write my custom action. After more researchs, i understood that i can do it with a command line which use robocopy and give folder permission during installation for this custom action or only with custom action.
for custom action, i tried many links, but the best link that i obtained was (How to give Read/Write permissions to a Folder during installation using .NET) without success (i change /folder="[CommonAppDataFolder][ProductName] with /folder="[CommonAppDataFolder][Manufacturer][ProductName] in customactiondata" due to the fact that product name is in my manufacturer folder").i don't understand why this code don't change folder permissions during installing and don't know how i can use robocopy or icalcs in custom action to change folder permissions during installation. my setup and others requirements have been packaged with dotnetInstaller, i dont know if i can be able to continue use it.
please, i greatly need your help to be able to do this

i have solved the problem. After many trying, i understood that i was giving permission to the wrong folder because my documents and database were contained in programfile folder. after understand this, i only change the place to set permission by :/folder="[ProgramFilesFolder][Manufacturer][ProductName]" and permission have been setted.

Related

Silverstripe install admin js errors

For some reason my admin screen just hangs with some javascript errors. I have it installed on xampp on windows 7 ultimate 64bit. What could be causing this? Ill post a screenshot of the errors any help would be nice! p.s. This is my first time installing silverstripe ever so be nice. :)
This sort of things usually occurs when combined asset files cannot be created. Make sure the web server user has write access to the assets/ and assets/_combinedfiles folders, then go to your-site.com/admin/pages?flush=1.
Alternatively, since this is a local install, run in dev mode. There are instructions in the documentation on how to set this.
As indicated by #simon_w, this issue occurs due to the folder permissions:
In your local environment, in addition to the way via yml config, you can just put the following in _config.php inside mysite folder.
Director::set_environment_type("dev");
In dev mode, the installation doesnt need to write to assets/_combinedfiles. However, you had better have write permission for assets folder anyway.
So, just increase permissions for assets and directories under it. Uploaded files are also stored there, if not sufficient permission, you can't upload files from the admin panel. Other functionalists may also be affected.

IIS unable to write to disk

I have one server that works (that I originally remember took me a loooong time to figure out--dont remember solution). I copy the exact same permissions to the new server, and it does not work. 'Everyone' is given total permission.
I have given permissions to _IUSR, IIS_USR, and Everyone., yet I still have errors with PHP trying to write/modify files.
Whats up?
You didn't mention IIS version you are using and what's application you are trying to run on top of it - these would be helpful to get a proper answer.
Looking at account names you mentioned you are running IIS 7.x... If you are running app which requires some fancy permissions config on its folders and files just try to temporarily grant full access to Everyone and IUSR from the top of app folder (overwriting everything below it) just to verify that this is permissions problem indeed.

Access denied when writing to a file. Why?

I've developed an ASP.NET v4 web app which I am trying to get to write to a folder in the webroot.
For the life of me I cannot get Windows 7 to allow it to write a file, I get Access is Denied error each time.
What I have tried on the folder is
attrib -r /foldernameandpath
attrib -r -s /foldernameandpath
Removing Check from ReadOnly attribute in folder properties
Changed owner to folder to current user whom is also the admin
Changed owner to Everyone
Adding Everyone user to folder with all permissions
Changing the folder to the Public Document directory
Changing to the root of the C drive (Out of desperation)
Nothing seems to work and all I want to do is test that the write works.
Now I know the system works and writes fine cause I had this same web app on a second machine writing the PDFs to the C drive without issue. This second machine I just cannot get it to allow the write.
Oh please for the love of all things holy, put the keyboard and mouse down and stop what you are doing. Some of the actions in your list seriously frightens me.
All the things you list as your actions are most likely useless or desperately random at best.
As a web developer, you shouldn't have to start messing around changing ownership of folders, especially not the web root folder normally used by the web server. When you do, you'll end up in a dark, cold and lonely place. Lord only knows what other desperate measures you have taken. For your own sake, I'll recommend you to do a system restore or even system reinstall to make sure you are in a healthy state.
Let's go back one step and try to sort out what you are doing.
First: what is the path you are trying to write to?
Second: are you running this application directly from within Visual Studio or in IIs?
If you are doing the first option then your current user account is the account who tries to write to the path in question. Do you have write permissions there?
One thing you can try is to start Visual Studio with elevated permissions and see if that works.
If you are running in IIs, it the associated pool account that needs write permissions.
Are you doing impersonation by any chance? If so, make sure the impersonated account have proper permissions.
You should only write to a predefined folder within your app path, like ..\App_Data for example.
The easiest way to find out which account you are running with and determine what path you are trying to write to, is to fire up SysIntenals process monitor and find the entry with the access denied result. Select properties for that entry and find out which account tried to do the write action. When you have determined that, right click on the folder in question and give the proper account write permissions.

Change folder permission after deploy

I have in my application a folder where I save files uploaded by users. This folder needs write permision for the apppool user. Untill now I did it manualy.
My question is, if this could be done somehow automatic ? Maybe running some script after deploy or something like this.
I have not tried this out myself, but it seems as if you could do this with the deployment package stuff in vs2010:
http://leethams.wordpress.com/2010/06/12/modifying-directory-permissions-with-web-deployment/

Where should I put my log file for an asp.net application?

I have a ASP.NET application that we've written our own logging module for.
My question is, where is the standard place to write a log file to? I.e. the website will be running as the anonymous user identity (e.g. IUSR on IIS7) and I need a place where I know it'll have permission to write to.
Cheers,
App_Data folder on the root of the project. It isn't served to web requests; so other people can't snoop for it.
I would suggest putting the log file onto a seperate disk, though should give you a little performance gain so that your not trying to both read and write to the same disk as the website. If you cannot put the log file on a seperate disk, then I would simply choose a folder of your choice.
In any case, you will have to give the "Network Service" account "Modify" permissions to the desired folder.
If on the other hand, you have access to a databse, then log the information there. It will be much quicker than accessing the hard drive and won't be publically available. You'll also be able to report from the data quite easily.
I'm not in a position to modify the permissions on folders (especially outside of the virtual directory home folder), and don't already have an App_Data folder, so am a bit hesitant to go with that.
So for the moment I'm going with the CommonApplicationData Folder.
On Vista/Server 2008 this is C:\ProgramData\
On XP/Server 2003 this is C:\Documents and Settings\All Users\Application Data\
I'm not in a position to modify the permissions on folders (especially outside of the virtual directory home folder), and don't already have an App_Data folder, so am a bit hesitant to go with that.
If you have a website, you clearly have a folder somewhere. Can you not add a (non-web-facing) subfolder? It seems like that would be a more appropriate place to put your logs than dumping them into a global, shared folder.
You could also log to the Windows Event log or to a table in a database. How often are people looking at the event log? If it's being examined on a regualr basis, writing to a table amkes the reporting back much easier as it's trivial to reverse the order and only show the last X events for the current time period. The Windows Event log you can also query the Windows Event Log through PowerShell or with LogParser.
Push the app_data is the best idea, just bear in mind, when the publishing the projects, if the option "Delete all existing files before publishing" is ticked, then the current data in the folder will be gone. The workaround is to skip the deletion of app_data folder.
Another option to do logging is to use some existing framework such as Log4net.

Resources