Folder accessing error in ASP.NET - asp.net

I am working on a asp.net website which is created by someone else.
Some files are exist in root folder and some are exist in one sub folder.
I can access all files from root folder in the browser, however when try to access the pages from sub folder is shows following error
Access is denied.
Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
Error message 401.2.: Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server. Contact the Web server's administrator for additional assistance.
I unable to point out the issue. I checked the web.config file, but didnt get anything related to that folder. I know it is difficult to find the exact issue in my case, but I would appreciate if anyone can give me possible reasons or clues so that i can try.
Thanks in Advance.
EDIT
There is a sub folder web.config with the following content
However, even if I login with "administrator" it fails.
I got the issue, actually previously it was Forms authentication which I commented out.

Is there a web.config file in the sub-folder? These can apply local restrictions.
Other questions that it would be good to know the answer to:
What authentication scheme (forms, windows etc) are you using?
What sort of content are you trying to access (static content or aspx)
what version of IIS are you using?

This sounds like an ACL problem to me. More information, as Xhalent asks, would be useful. Does the user that IIS is using have access to all of the files on the file system?

Related

Can't Access App_Code and App_Data on IIS

I just published my ASP.NET Website on IIS and have already configured it to be working, everything is running smoothly.
Except.. I can't accept the App_Data file where all my database information is stored. That might not be the only folder that i can't access but maybe possibly App_Code too? Where i place all my Data Access Object classes (CRUD).
I searched high and low on blogs, articles and stackoverflow but i still can't find the solution to accessing the folders.
I also read that by default certain file extensions are being blocked by IIS
These are some hopefully useful information..
It appears that App_Data and App_Code folders are empty..
Codes in Web.config file from Published Directory
Have some issues copying the codes..**
File Segments in IIS
ConnectionStrings in IIS
Error i'm getting..
Any help is appreciated..
Ok this is what you can try to isolate the issue.
Enable Failed Request tracing for the website for which you are seeing this failure.
This will help you determine where the error might be coming from.
Looking at the call-stack you provided, it seems that there is a different issue. I would suggest you to debug the web app on the server to understand what the problem is. Refer the instructions here: https://msdn.microsoft.com/en-in/library/mt621540.aspx

Hosting ASP.NET in IIS7 gives Access is denied?

I have setup a application in my IIS7 that uses .NET Framework 4.0 (runned by NetworkService) but when browsing the site I get this:
Access is denied.
Description: An error occurred while accessing the resources required to serve this request. You might not have permission to view the requested resources.
Error message 401.3: You do not have permission to view this directory or page using the credentials you supplied (access denied due to Access Control Lists). Ask the Web server's administrator to give you access to*
I have tried to give NetworkService full permission on the folder that holds the website (the one that the web application in IIS is pointing against) but I do still get the access denied?
Why?
I gave access to "IIS_IUser" but instead it should be "IUSR". That solved the problem.
For me, nothing worked except the following, which solved the problem: open IIS, select the site, open Authentication (in the IIS section), right click Anonymous Authentication and select Edit, select Application Pool Identity.
I had the same problem, I enabled "Anonymous Authentication" but it still did not work.
So I also ENABLED "Forms Authentication" Then it worked without any problems.
OS : Windows 7 & IIS 7
If you still have permission denied after adding IUSR & NETWORK SERVICE.
Add also IIS_WPG. The addition of this last user solved my problem.
For people who can't find those users:
when you're trying to add a user in security of the folder (properties of the folder), click on "Advanced" of the window "Select Users or Groups". Change the location to the computer name then click on "Find Now". You'll find those users in the list below.
If you're using Anonymous Authentication, IIS 7 will use the "IUSR" account for directory access (unless you've set it to use the app pool identity. If you haven't granted IUSR sufficient permissions on your site's folders and files, you'll get this error
For me in windows 7 it started to work only after I gave 'Read & execute', 'List folder contents', 'Read' permissions to site folder for both users
IUSR
NETWORK SERVICE
Tried most of the solutions here, but no luck. What worked for me was adding "Everyone" to the security permissions. Properties -> Security -> Edit -> Add -> Everyone. The given defaults were enough for me to regain access.
In the near future, I should probably figure out what credentials are being sent to the server so that I can give proper permissions. But I hope it helps someone!
In the Authentication settings for APP itself (IN IIS), see if you have anonymous enabled.
We need to create a new user ComputerName\IUSR by going to the website folder-->Properties--->Security--->Edit-->Add and give read access. This would work definitely.
This solution is for IIS7
I went round and round on this and it turned out to be improperly set default page. Hope this helps someone else avoid an hour of wasted time.
In my case running c:\windows\Microsoft.Net\Framework64\v4.0.30319\aspnet_regiis.exe /i resolved the 403 access denied issue.
Checking the Application Pool Identity in Anonymous Authentication and enabling Forms Authentication would solve problem for access denied error. 😁
After some thinking and a lot of of trial and error I found out that this error occurred because part of my web.config was encrypted and for some reason the key was no longer valid.
Re-encrypting the config section solved the issue.
After watching this tutorial :
https://www.youtube.com/watch?v=RbrZbHpXBTE&list=PLp1Emx1rT4z9YWLDXBjUwBb130qv2Zq2x&index=4&ab_channel=LearningProgrammingTutorial
I had the same problem using RDP ( windows server 2016 Datacenter )
i followed the tutorial above & enbaled my directory browsing options from the IIS internet infromation services manager.
what you want to do is to access your IIS manager , you can check out the tutorial above to learn how to access IIS manager if you have trouble acessing there , it was useful for me that's why I'm sharing then ... go to :
you should gave access to IUSER
( or application tool identity , depends or what you want to work with )
and your problem would be solved! :)
Also you need to check your firewall and TCP settings , if ping between two machines didn't work for you , you can check this out :
https://operavps.com/rdp-connection-issues/
It was due to WWWRoot directory security issue.
Simple solution is, Just copy applicatio folder to some other drive, Instead of "C:\Inetpub\wwwroot"
and then create a virtual directory for this new path. That's it.
If the IUSR user is already specified in Authentication and you're still getting this issue, it could be that your Directory Listing isn't enabled. Be sure to check that. That was the case for me.
This is what happened to me:
Get - Post is ok. Working well.
When I try to use Options verb, the server return error like that.
Then, beware with urlScan
I add OPTIONS verb to urlscan configuration .ini file, then everything works well.
To check if urlscan is installed or not, open your iis manager, and open ISAPI FILTERS url scan should appear at the list.
I was also facing the same issue,
Everything was normal all the rights were given to the user and for folder as well.
After many research i found that the wwwroot (Source code folder) was shared with some other user.
I stopped sharing and it worked like a charm.
I was facing this issue after pulling from remote master and adding to the appsettings on web.config.
I solved it by enabling Windows Authentication:
Click on the project and press f4
Make sure Windows Auth is enabled:

Quick Question About IIS 7 Asp.Net Setup

I have been trying to configure a small website on a Windows Server 2008 running IIS 7. Unfortunately, when trying to load the website I keep getting the error: Server Error 401 - Unauthorized: Access is denied due to invalid credentials.
The permissions on the website folder include read, write, and execute for user ASP.NET v4.0. I even clicked "Check names" before adding the user to folder, to make sure that I spelled everything correctly. But the error continues to show. Also, I noticed that everything works okay if I add "Users" to the permissions for the folders containing the website, but I don't see why this should be necessary. I only want to give ASP.NET v4.0 access to the folder.
Some other noteworthy points include that I'm using the ASP.NET v4.0 application pool, that the managed pipeline is integrated, and that load user profile is set to true.
If anyone has any ideas, I'd appreciated the help. I'm stumped!
EDIT: Does it matter that the website is on the d: drive? I just assumed this wasn't important...
I find I always need to give IIS_IUSRS access.
I'd recommend you to use the Process Monitor to detect which user is actually accessing the file.
Here you'll find an explanation about how to achieve that.
Open IIS7 on the server. Highlight the site, and double-click on the Authentication icon in the Security Section. Check that Anonymous Authentication is enabled.
Some troubleshooting links for this particular issue:
http://support.microsoft.com/kb/902160
http://support.microsoft.com/kb/907273

Handler not yet determined error

I don’t know anything about deploying a website, so I probably made some stupid mistake.
Anyways, I opened IIS 7 manager, created new virtual directory ( via Add Application ) and pointed it to physical directory where Visual studio saved my Web project. But when I tried to request an .aspx page, browser reported the following error (I won’t post the whole error, but just the interesting bits):
Handler: Not yet determined
Config Error: Cannot read configuration file due to insufficient permissions
Logon User: Not yet determined
A) why is handler not yet determined? As far as I know, IIS7 does have Asp.Net handler registered?!
B) Why wouldn’t IIS have sufficient permissions? Does that mean I should give IIS higher privileges? Or does Asp.Net runtime have insufficient permissions?
C) Could the error also be due to the fact that perhaps it expected the user to authenticate itself? I’m assuming this due to Logon user not yet being determined?
D) And finally, any ideas how to make it work?
thanx
error code:0x8007000d
I started playing with permissions and all the stuff about access issues to web.config or applicationhost.config anyway those did not change the error.
while I was playing with my web.config I deleted rewrite tags from my config file and error changed. then I installed "web platform installer" and installed url rewrite module for IIS and played with some configuration now my site is working. it took about one day to find out this issue I hope it helps someone.
Does the identity of your IIS application pool have sufficient rights to access the folder that is hosting your site?

ASP.NET & IIS7 : losing access rights all of a sudden

I'm working locally on an ASP.NET website under Windows 7, and I experience stange behaviours sometimes ...
I've been working several days with several Visual Studio opened, working on the website, then I switched to compiling and deploying some others apps until yesterday, and today, I had to get back working on the website.
So I launched a browser and entered the url "//localhost/" as usual ...
Unexpectedly, IIS tells me :
HTTP Error 500.19 - Internal Server
Error
Error Code 0x80070005
Config Error Cannot read configuration
file due to insufficient permissions
Config
File \?\C:\DVP-WP\SQ2sln_web\web.config
Well, 2 days ago, web.config was accessed without trouble !
What happened? Of cours, I cannot remember having changed anything regarding ACL or accounts or .. just writing c# code and asp.net and compiling !!!
Why does this happen ?
STEP2: So I went to the folder where the website files are located and applied some security:
I specify machine\IIS_IUSR to have read access to the folder website folder ("SQ2sln_web")
... OK , II7 now servers the aspx pages I request at the root level ... but not the css file!
HTTP Error 401.3 - Unauthorized
Requested URL
[...] localhost:80/soquiz.css
Physical Path
C:\DVP-WP\SQ2sln_web\soquiz.css
Logon Method Anonymous
Logon User Anonymous
So I set some specific rights to the file itself (see picture at http://soquiz.com/resources/documents/acl%20problem%20file%20specific.gif)
... but it did not solve the problem
1) Does anyone know WHY or HOW access rights change ?
2) Does anyone know why setting specific acl to one file do not work ?
Thank you!
I think you need to check the account that your application pool is running under as well.

Resources