forms-authentication

Change the user data in FormsAuthenticationTicket programmatically

僤鯓⒐⒋嵵緔 提交于 2019-12-20 08:42:01
问题 I am using the FormsAuthenticationTicket and place the data and passing the data across all the pages. and it will work if we are not changing any data. So, now if I want to change the data and pass it for the cookie and encrypt then how to change the data programmatically. Please give me the solution for changing the data in HttpCookie programmatically. 回答1: This is an example of how I modify an already-issued forms auth ticket: HttpCookie cookie = FormsAuthentication.GetAuthCookie(Username,

Auth login with email or mobile Cakephp

最后都变了- 提交于 2019-12-20 06:16:20
问题 I am working on cakephp 2.x.i have a table in my database name user and it has 4 fields id, email, password and mobileNo i have two fields in my login.ctp <?php echo $this->form->create(); echo $this->form->input('email'); echo $this->form->input('password'); echo $this->form->end('submit'); ?> what i want is i want to login the user from his mobileNo too(if he typed mobile number rather then email address) just like facebook has done ..he can either login with hi email address or mobileno .i

ASP.NET mvc auth or session expires quicker than set

此生再无相见时 提交于 2019-12-20 04:34:06
问题 In my ASP.NET MVC5 website the login and session timeout in web.config are as follows: <system.web> <authentication mode="Forms"> <forms loginUrl="~/Account/Login" slidingExpiration="true" timeout="60"/> </authentication> <sessionState mode="InProc" timeout="60"/> </system.web> Still the session or authentication times our in five minutes. I have approached my web hosting provide to increase the timeout in IIS and they shared a screenshot after increasing the timeout in IIS, but nothing

Handling Login.Authenticate event

末鹿安然 提交于 2019-12-20 04:33:05
问题 A) Book I’m learning from says that if we handle Login.Authenticate event, then we have to authenticate users on our own. Thus control won’t automatically validate username and password. I thought book suggested this would only happen if we override Login.OnAuthenticate() method, but it appears that even if only add an event handler for Authenticate event, the automatic authentication doesn’t happen. But why is that? Why doesn’t event handling work like it does with Init or Load events, where

Handling Login.Authenticate event

北慕城南 提交于 2019-12-20 04:32:37
问题 A) Book I’m learning from says that if we handle Login.Authenticate event, then we have to authenticate users on our own. Thus control won’t automatically validate username and password. I thought book suggested this would only happen if we override Login.OnAuthenticate() method, but it appears that even if only add an event handler for Authenticate event, the automatic authentication doesn’t happen. But why is that? Why doesn’t event handling work like it does with Init or Load events, where

With ASP.NET membership, how can I show a 403?

南笙酒味 提交于 2019-12-19 10:32:33
问题 By default, ASP.NET's membership provider redirects to a loginUrl when a user is not authorized to access a protected page. Is there a way to display a custom 403 error page without redirecting the user? I'd like to avoid sending users to the login page and having the ReturnUrl query string in the address bar. I'm using MVC (and the Authorize attribute) if anyone has any MVC-specific advice. Thanks! 回答1: I ended up just creating a custom Authorize class that returns my Forbidden view. It

Asp.net MVC Let user switch between roles

心已入冬 提交于 2019-12-19 10:19:33
问题 I'm developing a complex website with users having multiple roles. The users are also coupled on other items in the DB which, together with their roles, will define what they can see and do on the website. Now, some users have more than 1 role, but the website can only handle 1 role at a time because of the complex structure. the idea is that a user logs in and has a dropdown in the corner of the website where he can select one of his roles. if he has only 1 role there is no dropdown. Now I

right way to have role based custom auth query database on every request asp.net mvc

戏子无情 提交于 2019-12-19 09:47:13
问题 This may be a slightly ignorant question but Im new to mvc so Im sorry! I studied the nerd dinner auth model but In my app I have a complicated role based authentication. So What I do is this: void MvcApplication_PostAuthenticateRequest(object sender, EventArgs e) { HttpCookie authCookie = HttpContext.Current.Request .Cookies[FormsAuthentication.FormsCookieName]; if (authCookie != null) { string encTicket = authCookie.Value; if (!String.IsNullOrEmpty(encTicket)) { FormsAuthenticationTicket

How to change FormsCookieName at runtime in ASP.NET

南笙酒味 提交于 2019-12-19 08:14:34
问题 We would like to have the FormsCookieName of FormsCookiePath change per instance of our application. We have an application which has multiple instances on 1 server/domainname. Because of this we can only work in 1 application at the same time, since the cookies will overwrite eachother. Same for the Sessions btw. Is there a way to dynamicly, for example in the Global.asax Application_Start, change this name? This would be usefull as we keep a license name in each application which could be

How to change FormsCookieName at runtime in ASP.NET

穿精又带淫゛_ 提交于 2019-12-19 08:14:00
问题 We would like to have the FormsCookieName of FormsCookiePath change per instance of our application. We have an application which has multiple instances on 1 server/domainname. Because of this we can only work in 1 application at the same time, since the cookies will overwrite eachother. Same for the Sessions btw. Is there a way to dynamicly, for example in the Global.asax Application_Start, change this name? This would be usefull as we keep a license name in each application which could be