Hi,
>When using Forms Authentication the cookie's value contains an
authentication
> ticket and the ticket has a timeout.
>When using Role Manager, does the roles cookie have a ticket and a time
out
>too.
>If so when and where does it get the value?
>Thanks,
It depends on the provider of Role Manager. If you're using
SqlRoleProvider, when you call Roles API such as Roles.IsUserInRole(string
username, string rolename), the IsUserInRole(string username, string
rolename) method of the SqlRoleProvider will be called, which queries
database to check if the user is in the role. In the IsUserInRole(string
username, string rolename) method, a stored procedure will be called, see
below:
public override bool IsUserInRole(string username, string roleName)
{
bool flag;
SecUtility.CheckParameter(ref roleName, true, true, true, 0x100,
"roleName");
SecUtility.CheckParameter(ref username, true, false, true, 0x100,
"username");
if (username.Length < 1)
{
return false;
}
try
{
SqlConnectionHolder connection = null;
try
{
connection =
SqlConnectionHelper.GetConnection(this._sqlConnect ionString, true);
this.CheckSchemaVersion(connection.Connection);
SqlCommand cmd = new
SqlCommand("dbo.aspnet_UsersInRoles_IsUserInRole", connection.Connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = this.CommandTimeout;
SqlParameter parameter = new SqlParameter("@ReturnValue",
SqlDbType.Int);
parameter.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(parameter);
cmd.Parameters.Add(this.CreateInputParam("@Applica tionName",
SqlDbType.NVarChar, this.ApplicationName));
cmd.Parameters.Add(this.CreateInputParam("@UserNam e",
SqlDbType.NVarChar, username));
cmd.Parameters.Add(this.CreateInputParam("@RoleNam e",
SqlDbType.NVarChar, roleName));
cmd.ExecuteNonQuery();
switch (this.GetReturnValue(cmd))
{
case 0:
return false;
case 1:
return true;
case 2:
return false;
case 3:
return false;
}
throw new
ProviderException(SR.GetString("Provider_unknown_f ailure"));
}
finally
{
if (connection != null)
{
connection.Close();
connection = null;
}
}
}
catch
{
throw;
}
return flag;
}
This should address your question "where does it get the value". As to
"when does it get the value", it depends on when you call the Role Manager
API. You may intentionally call it or use other APIs that implicitly call
it.
Hope above information helpful. If you have additional questions please
don't hesitate to let me know. I'll do my best to follow up.
Regards,
Allen Chen
Microsoft Online Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.