Message: Sys.WebForms.PageRequestManagerServerErrorException: Cannot open database "[DB_NAME]
Just follow these simple steps to solve the problem.
1. Open SQL Server Management Studio.
2. On the left menu, expand Security then Logins. Check if 'NT AUTHORITY\IUSR' exists. If not then that is the cause of the problem.
3. Right-click on Logins then click New Login...
4. On the General page, click Search...
5. On the next popup window, click Advanced...
6. Then on the following window, click Find Now and find IUSR on the Search Results. Then click OK.
7. Back on the left menu, you'll now see the 'NT AUTHORITY\IUSR' user. Right click on it and click Properties.
8. On the Server Roles page, check on sysadmin.
9. Then on the User Mapping page check on the database name you need access to; and below that on the database role membership make sure to also check on db_owner then click OK.
...And that's a wrap, you shouldn't be seeing the login failed error now.
-k
Thanks for the article this really helped me out.
ReplyDeletegreat article...
ReplyDeleteu solve my problem juz now...
thanks :)
Thanks for the article..
ReplyDeleteit helped me alot..
thank you so much
ReplyDeleteit solved my problem.......
it helped me after lot of frustuation
I have NT AUTHORITY\IUSR as part of the allowable login users to my SQL but still getting the same error
ReplyDeleteThanks a lot, after several hours of playing around, just what I needed!
ReplyDeleteA wonderful , Clear and working solution to my frustrating problem.
ReplyDeletethank you very very much you help me in this topic
ReplyDeleteREALLY THAAAAAAAANKS FOR THISSSSS
ReplyDeleteI have to disagree with this solution, my understanging is this solution grants any anonymous users access to the database which is really bad.
ReplyDeleteHi guys, I am trying to follow the instructions but I cannot see 'NT AUTHORITY\IUSR' in the list of my SQL users. How can I add this user? Anything should be set in IIS?
ReplyDeleteThanks,
V
Gracias, me ayudo mucho =)
ReplyDeletethanks! that helped a lot!
ReplyDeleteu my hero!!!!
ReplyDeletethanks
Goood one
ReplyDeleteThanks
Thanks a lot, I was so confused having this problem, well done.
ReplyDeleteGreat Article!! Thanks for it!! Just solved my problem in a minute...
ReplyDeleteVery Thanks Honey :xXx it solved my problem....
ReplyDeletethanks a lot, awesome article!!
ReplyDeleteThank you so much! This solved my problem :-)
ReplyDeleteAwesome! It worked!
ReplyDeleteMuch appreciated that you took the time to post this how-to
ReplyDeletegood work, thanks
ReplyDeleteThank you!!! :)
ReplyDeleteVery VERY helpful!
Problem SOLVED!!!
ReplyDeleteThanks to you
yahhhhhhhhhhhh
ReplyDeleteI am having this error(below):
ReplyDeleteLogin failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
Adding the 'NT AUTHORITY\ANONYMOUS LOGON' the problem goes away...but I am concern about giving database ownership to NT AUTHORITY\ANONYMOUS LOGON.
Should I be concerned? THanks
oh my god... I am concern about giving database ownership to NT AUTHORITY\ANONYMOUS LOGON.
ReplyDeletevery much appreciated!!
ReplyDeletei really prefer tutorials with pictures. very helpful man. thanks
Please don't do this. Granting DBO access to IUSR* is a very bad idea. You want to grant the least rights possible to users. If, after granting public access to a user you still see errors you should be granting access to the stored procedures you are using to public, not just giving users the ability to create or drop any table they like.
ReplyDeleteI hope you are joking... this is a suicide
ReplyDeleteWhat an amazingly bad idea. Granting sysadmin privileges on the server to IUSR or ANONYMOUS LOGON is setting your machine up to get rooted easily. Assign permissions on an as needed basis, granting the absolute minimum required to any given database user.
ReplyDeleteThis article, combined with the "Thank you so much!!!" comments makes this the FUNNIEST. POST. EVER.
ReplyDeleteI'm printing this out and hanging it on my wall of "Worst Advice In The History Of The World". The author of this post is truly without a clue.
ReplyDeletePlease folks do NOT follow this advice. This is the SQL Security equivalent to enabling the Guest account in windows.
ReplyDeleteInstead the account needed to access should have very minimal rights and only to those objects required. For example, if the account needs to only perform SELECTs and only a few tables, please put the rights specifically there. If there are plenty of tables, create a role and assign permissions that way. Worse case add the user to the data readers.
Bah..Bah...Bah..
ReplyDeleteLots of stupid sheep out there.
If you don't know what you are doing maybe you should find another profession.
Thanks a lot.
ReplyDeleteYou r the man :)
ReplyDeleteThank a lot Prof.
Well done. It solved the issue
ReplyDeleteThanks, solved the purpose!
ReplyDeleteThanku so much dear
ReplyDeleteThanks a lot.It Solved My Problem.Thanks again
ReplyDeleteLeaving my front door open would solve the problem of the next door neighbour not being able to get in and feed the goldfish whilst I'm on holiday...
ReplyDeleteI really appreciate this type of information, thank you very much for the help, you've helped me solve my problem, Greetings!
ReplyDeletethanks a lot.
ReplyDeletemaster muchas muchas pero muchas gracias!
ReplyDeletetoo good. 2 days of hard work, din't found this issue. thanks to this blog :)
ReplyDeletevirtually all unbelievable foodstuff blogs http://casinogamesonlinex.weebly.com casino games online
ReplyDeleteThanks a ton! This is exactly what I needed and following these steps solved my problem. Thanks for sharing this.
ReplyDeleteThanks a lot. it solved my problem.
ReplyDeleteYou are great keep up the good work you solved my problem
ReplyDeleteThis is great article. The problem is solved.
ReplyDeleteThanks you save my time
ReplyDeletei was struggling for 2 days
keep it up
KAS
Thank You, Thank You, Thank You, Thank You, Thank You. This post helped me a lot.
ReplyDeleteThis post has helped me too. I am very thankful. i am wowed at the solution. It worked like magic
ReplyDeletelet me just say thank you too ;)
ReplyDeleteSuper Super. Thanks a lot!
ReplyDeleteThank you! Solve my problem!!!
ReplyDeletei love u
ReplyDeletewhen i host that time it show me error how can solve that time plz help me amil me at desaimandar2@gmail.com plz plz help me
ReplyDeleteI can not see IUSER in search directory
ReplyDeleteDONE DONE DONE DONE......WOW WOW WOW WOW........ Problem finally resolved :)
ReplyDeleteAn you wonder why credit cards and personal information get stolen..
ReplyDeleteSuch blogs make our work so easy. thanks alot..keep up the amazing work you are doing
ReplyDeleteThis is the worst advice you could possibly give, granting IUSR sysadmin access and then map it to the database as a db_owner shows a clear misunderstanding of database security. There will now be a lot of vulnerable webpages out there now.
ReplyDeleteJust map the login to the required database with only the required permissions, i.e read only if all it does is display data on webpages even better execute permission to the stored Procedures which display and update data. Use ‘The Principle of least privilege’ to help protect your site, its exposed to the internet.
The above advice will allow for a SQL injection attack which could delete every database on the server and possibly delete all backups using xp_cmdShell, a sysadmin can enable it.
It goes on but I’ll stop now.
Thank you, this solved my issue.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThank you sir, solve my issue
ReplyDeleteWow..Solved my issue!!!Spend last two days resolving the same.Thanks
ReplyDelete