Click here to Skip to main content
13,503,090 members
Rate this:
Please Sign up or sign in to vote.
Hi I'm building an application using C# windows form and SQLExpress2008
As for the security I decided to set some application roles.
I read few articles about what they are and how they work but honestly didn't get a thing!
As I realized the application role is active as long as the application is connected via an open sqlconnection. So the moment the connection which executes sp_setapprole is closed the role itself seems to be lost. At this point granted permissions are revoked and it throws an unhandled sql exception saying "Select permission is denied".
Do I have to simply let the connection be after I've executed sp_seapprole procedure? Can any one please get me out of the dark please!
Posted 29-Dec-12 21:04pm
Abhishek Pant 30-Dec-12 3:43am
just use login based admin roles.if username is this then admin form opens and if other then other
SedMhd 30-Dec-12 6:11am
thanks for your quick replay.
The thing is that the database revokes the user's permission as it's supposed to but it won't grant the application role's permissions. I personally think it makes sense! I close the connection by invoking Close() method of the connection after executing sp_setapproll. So the database has no chance to recognize the application on further connections. So how can keep the database aware of the application when I'm establishing another connection to the database?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.180417.1 | Last Updated 30 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100