i am trying to create a folder using
Directory.CreateDirectory(Server.MapPath(pathToCreate));
i get Access is Denied error.
no problem in localhost.
Do you have file system write access enabled in your AppHarbor application?
I think you also need to do a re-deploy of your application after enabling it, but not 100% sure.
UPDATE: Based on the poster's response, yes you do have to do a re-deploy after enabling this option.
Related
I am creating a .exe to install my MVC application on to client's servers. It downloads zip file from the internet, extracts all files into the correct places, updates the web.config file to include all the correct app keys.
The problem that I am having is that IIS doesn't have permissions to read web.config so I get a HTTP Error 500.19.
I know that I can just give instructions to the installer that tell them to add the permissions manually, but that looks a bit cheap.
So, in C#, what can I do at the end of my installer to allow IIS to read my web.config file and really everything else in my site.
I know that I can just give instructions to the installer that tell them to add the permissions manually, but that looks a bit cheap.
I dont really think that this is a bad idea. All webfiles must be accessable from the user IIS_IUSRS of the local server/computer. If they dont have this permission, you get access problems like you state it above.
I suggest you to take a look on the FileSecurity class of C#. You will be able to set file permissions, even if it´s only for the web.config.
I've written a simple console application in VS what users should retrieve from a website. In IE I'm able to download by right-click -> 'Save target as...', but a simple click on the link drops me the below error.
I've "googled" around and it seems there is no reliable way to force the download and skip the choice of direct running.
Is it possible that my app has some signature or security issues? How can I avoid this error?
*edit: It's just a standalone program, not an installer.
*edit2: Not a duplicate, it has to work on a static html page.
After removing ClickOnce manifest signature I don't get the error, and I can download it without any issues.
I've just finished developing the core features of my site, and have now uploaded it to a host to test.
Unfortunately, I get the following error:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
After tedious searching, I realised that it's because I developed in a full trust environment, and my stubborn host will only allow medium trust.
When I set medium trust in web.config, the debugger doesn't show what exactly needs the full trust environment.
Is there any way to clearly check this, or somehow force the site to co-operate?
I am using MVC with FormsAuthentication, Code-First Databasing, etc.
After a LOT of trial and error, I have found the error.
Microsoft's SignalR requires full trust, and there is no way around it.
Disabling that fixes the issue.
Edit
It also seems that any library that will help the site out in the long run is out. If anyone is getting this error, simply disable (comment out) any tertiary library you use BEFORE altering your core code.
Breakpoints do not help at all, as after disabling SignalR, I had an error on a certain page. Setting a breakpoint didnt stop the code in the error event, as it turns out the Security Exception is thrown somewhere deep inside C#, and not brought to the top.
You have two options
You could have two web.config files, one for debugging and one for publishing and testing under an environment that is as close as posible as your hosting environment.
Another option could be two have a single config file with the medium trust set, and use logging to a file/event logger to allow you to debug
I have develop a small web application in asp.net (c#) for uploading files into data base it is working fine in my local machine .But when i tested in the server it showing error like
C:\inetpub\vhosts\crosstouch.com\httpdocs\Images\100898.jpeg' is denied
what can i do to resolve this problem please help me....
By default the you wont have write access to this directory. See this note for IIS6 or search MSDN for whatever version you're using.
http://support.microsoft.com/kb/816117
Give write permission to IISUSER in
C:\inetpub\vhosts\crosstouch.com\httpdocs\Images folder
give a permission to Images folder..
i think you are using Plesk Panel for Handle it....
use Hosting Control Panel and Give permission...
I just need to create an extremely basic web server that will basically allow me to go to http://1.2.3.4:8080 and browse a list of files in C:\web or something.
I found this http://mikehadlow.blogspot.com/2006/07/playing-with-httpsys.html which looks perfect but I ran into a couple of questions.
1) When I replace the IP with * or + like the documentation says, I get access denied errors in system.dll. When I use localhost or my local IP it works fine. Why is this? I would like to potentially be able to bind it to a specific IP address on machines that have more than one.
2) I am probably missing something, but how do you specify the core directory where the files are that it is serving with this code?
re 1: because you dont have permissions to register this url. Use "http add urlacl2 to register permissions for your user (as admin) to make the binding. Example: http add urlacl url=http://+:8080/ user=DOMAIN\UserName
Re 2: You dont. THat is pretty much your code. Http.sys does not read from a file system - it is a driver. Your application must read the files and answer the request.
This might be a little overkill for what you want, but check out the aspNETserve web server project.
It is open source, so at the very least you can browse the code to get some ideas.
I know this does not help you with your code problems, but why re-invent the wheel! I think you should look at using IIS Express, as I think it could meet your needs nicely:
http://learn.iis.net/page.aspx/868/iis-express-overview/
IIS Express is a standalone executable that will provide all the functionality you need. It will also run on Windows XP and above.
Here's a Simple and Secure C# Webserver, offering Digest authentication without the need for Active Directory. Digest Auth is broken, but it is not practical to crack with passwords over 18 characters, anyway one can see how to make a webserver using C# and .NET HTTP.SYS which was the point of this question.
https://git.motes.camp/web/index.php?p=DigestAuthWebServer.NET-HTTPSYS.git&a=summary
clone url: https://git.motes.camp/DigestAuthWebServer.NET-HTTPSYS.git