I have a few pages setup using role protection. However, the site cant be using cookies. Is there a way to login the user and gain access to the role based protection pages?
I have set the ticket by using the code (Displayed below). It logs in fine but as soon as i get redirected to a page that has protection on it, it logs me out.
ticket = new FormsAuthenticationTicket(2, model.Username, DateTime.UtcNow, DateTime.UtcNow.AddMinutes(int.Parse(ConfigurationManager.AppSettings["TicketTimeout"])), false, Guid.NewGuid().ToString());
if (ticket == null)
{
throw new Exception("Error creating authentication ticket");
}
// Encrypt the ticket.
EncryptedTicket = FormsAuthentication.Encrypt(ticket);
HttpContext.Current.User = new GenericPrincipal(new FormsIdentity(ticket), Roles.GetRolesForUser(model.Username));
var member = Member.GetMemberFromLoginName(model.Username);
if (member == null)
{
throw new Exception("Error getting member from Umbraco");
}
When you say "the site cant be using cookies" do you mean you want a cookieless session - or the site doesn't appear to be creating a cookie when it should be?
Hi
The site is not using cookies, so I am creating a ticket and authenticating the user and storing it in cache. It works fine for document types that not protected. However, with protected it logs me straight out.
If i add the code FormsAuthentication.SetAuthCookie(). It works fine,
Role based Authentication
Hi
I have a few pages setup using role protection. However, the site cant be using cookies. Is there a way to login the user and gain access to the role based protection pages?
I have set the ticket by using the code (Displayed below). It logs in fine but as soon as i get redirected to a page that has protection on it, it logs me out.
Hi Antony,
When you say "the site cant be using cookies" do you mean you want a cookieless session - or the site doesn't appear to be creating a cookie when it should be?
Damian
Hi The site is not using cookies, so I am creating a ticket and authenticating the user and storing it in cache. It works fine for document types that not protected. However, with protected it logs me straight out.
If i add the code FormsAuthentication.SetAuthCookie(). It works fine,
Is there something I am missing?
is working on a reply...