Using SQL 2005 Appicatioin Roles with ASP.NET 2.0.

  • Thread starter Thread starter CuteDeveloper
  • Start date Start date
C

CuteDeveloper

Hi everybody!

I can not understand how to use SQL2005 Appicatioin Roles (AR) with
ASP.NET 2.0? The tricky thing here is that you have to set up your
connection string to use integrated authentication (otherwise you lost
auditing ability of Application Role). OK. After you set up AR in SQL
Server how the application knows about AR? Where do you set up it?

Thanks, CuteDeveloper
 
Hi everybody!

I can not understand how to use SQL2005 Appicatioin Roles (AR) with
ASP.NET 2.0? The tricky thing here is that you have to set up your
connection string to use integrated authentication (otherwise you lost
auditing ability of Application Role). OK. After you set up AR in SQL
Server how the application knows about AR? Where do you set up it?

Thanks, CuteDeveloper

Hi CuteDeveloper,

ASP.NET creates database and uses RoleProvider to access this
database. That's why you cannot use AR without any database.
Application knows about AR by settings in web.config file. To use
roles in your application you should add the following in web.config:

<roleManager defaultProvider="OdbcRoleProvider"
enabled="true"
cacheRolesInCookie="true"
cookieName=".ASPROLES"
cookieTimeout="30"
cookiePath="/"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
cookieProtection="All" >
<providers>
<clear />
<add
name="OdbcRoleProvider"
type="Samples.AspNet.Roles.OdbcRoleProvider"
connectionStringName="OdbcServices"
applicationName="SampleApplication"
writeExceptionsToEventLog="false" />
</providers>
</roleManager>

More about Roles implementation read msdn articles -
http://msdn2.microsoft.com/en-us/library/8fw7xh74.aspx

Regards,
Alexander Kleshchevnikov
MCP
www.klalex.com
 
Hi CuteDeveloper,

ASP.NET creates database and uses RoleProvider to access this
database. That's why you cannot use AR without any database.
Application knows about AR by settings in web.config file. To use
roles in your application you should add the following in web.config:

<roleManager defaultProvider="OdbcRoleProvider"
enabled="true"
cacheRolesInCookie="true"
cookieName=".ASPROLES"
cookieTimeout="30"
cookiePath="/"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
cookieProtection="All" >
<providers>
<clear />
<add
name="OdbcRoleProvider"
type="Samples.AspNet.Roles.OdbcRoleProvider"
connectionStringName="OdbcServices"
applicationName="SampleApplication"
writeExceptionsToEventLog="false" />
</providers>
</roleManager>

More about Roles implementation read msdn articles -http://msdn2.microsoft.com/en-us/library/8fw7xh74.aspx

Regards,
Alexander Kleshchevnikov
MCPwww.klalex.com


Thank you for a quick response, Alex!
You gave me the right direction and I found a nice explanation here:
http://odetocode.com/Articles/427.aspx

Regards,
Eugene







..
 
Back
Top