forms-authentication

FormsAuthentication object obsolete [using MVC5]

纵然是瞬间 提交于 2019-12-03 12:14:43
I'm using the following code in an MVC5 site: [HttpPost] [ValidateAntiForgeryToken] public ActionResult Login(LoginModel loginModel) { if (ModelState.IsValid) { var authenticated = FormsAuthentication.Authenticate(loginModel.UserName, loginModel.Password); if (authenticated) { FormsAuthentication.SetAuthCookie(loginModel.UserName, true); return RedirectToAction("AdminPanel"); } ModelState.AddModelError("", "The username and password combination were incorrect"); } return View(loginModel); } Which throws up the following warning: System.Web.Security.FormsAuthentication.Authenticate(string,

Custom forms authentication in MVC

醉酒当歌 提交于 2019-12-03 11:37:56
问题 I want to use authentication on my site in order to login to the Admin section. I already have my database schema, I don't want to use the ASP.NET membership tables for SQL Server. I have three tables: Employees, Roles, and EmployeesInRoles. I'd really like to keep this as simple as possible, but I'm having trouble finding a solution. I just want to use forms authentication with my tables so employees can log in, log out, change their password, etc. If anyone could direct me to a blog post or

How do I keep my Login.aspx page's ReturnUrl parameter from overriding my ASP.NET Login control's DestinationPageUrl property?

痞子三分冷 提交于 2019-12-03 11:33:55
I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET web application. I've got pages such as PasswordRecovery.aspx that are accessable to only Anonymous users. When I click my login link from such a page, the login page has a ReturnUrl parameter in the address bar: http://www.example.com/Login.aspx?ReturnUrl=PasswordRecovery.aspx And then after a successful login, users are returned to the PasswordRecovery.aspx page specified in the ReturnUrl parameter to which they no longer have access. Zack Peterson I found the answer on Velocity Reviews .

How did harmless crawler bypass WebForms authentication, and hijack a user's session?

不打扰是莪最后的温柔 提交于 2019-12-03 11:17:05
问题 Last night a customer called, frantic, because Google had cached versions of private employee information. The information is not available unless you login. They had done a Google search for their domain, e.g.: site:example.com and noticed that Googled had crawled, and cached, some internal pages. Looking at the cached versions of the pages myself: This is Google's cache of https://example.com/(F(NSvQJ0SS3gYRJB4UUcDa1z7JWp7Qy7Kb76XGu8riAA1idys-nfR1mid8Qw7sZH0DYcL64GGiB6FK

what's differences between “forms timeout”, “membership userIsOnlineTimeWindow” and “sessionState timeout”

主宰稳场 提交于 2019-12-03 11:13:50
What is the difference between these lines of code: <forms timeout="5" /> <membership userIsOnlineTimeWindow="5" /> <sessionState timeout="5" /> Thanks a lot. Forms ( FormsAuthention ) are used for authentication and when it times out it will logout user. You can 'prevent' timeout by setting SlidingExpiration property to 'true' and it will renew forms ticket on user activity (read request to asp) if needed. This will keep user logged on while he is 'active' on your site. Membership is used for user validation and userIsOnlineTimeWindow is there to help you track user activity so when it runs

MVC ASP.NET - Manually authorize someone and persist the authorization via Forms Authentication

ε祈祈猫儿з 提交于 2019-12-03 09:32:16
问题 I want the benefits of form authentication in ASP.NET. I want it to persist the authorization for me and such, but there's one thing different about my situation; I want to authenticate against a simple web service (specifically provided by the client). I have my code in place to look at the web place and see if they should be authorized, but how do I set the cookie[?] or authorization flag in ASP.NET that they know the current user is authorized. Basically... if (HttpContext.Current.User

ASP.NET MVC - Area or Separate Web Application for Administration?

孤者浪人 提交于 2019-12-03 09:14:51
问题 Up until now I've been using an MVC Area for the administration part of my mvc applications, but recently I've been rethinking this due to the fact that you can't have more than one configuration for forms authentication per application . This has become a problem becuase in a recent project I wanted to set the auth cookies not to expire for users, but I don't wan't this for administration users. I also don't want the user login page to be used to access the admin tools. I'm considering

Add User Roles on Registration (Forms Authentication) MVC3

落花浮王杯 提交于 2019-12-03 09:04:45
I am developing an MVC 3 project and want to add a user to a role when they are registered, using Forms Authentication. So I'd like to create some check boxes, or a drop down list showing the roles, which are selected and the user is assigned to the role as they are registered. I have this code so far, which works: public ActionResult Register() { ViewData["roleName"] = new SelectList(Roles.GetAllRoles(), "roleName"); return View(); } And in the view I have: <label for="roleName">Select Role:</label> @Html.DropDownList("roleName") @Html.ValidationMessage("roleName") This is HttpPost section of

windows authentication vs forms authentication

浪子不回头ぞ 提交于 2019-12-03 08:42:49
问题 I am trying to understand concepts of windows authentication, forms authentication and their differences. I am confused. Can someone help me in clarifying this. Thanks. 回答1: Windows Authentication refers to authenticating against Windows user accounts on the box that the application is running on. Forms authentication is a stand alone method of authenticating in .NET forms that you can hook up to some other system, such as a database. 回答2: Windows Authentication provider is the default

Multiple applications on a single site - session and forms authentication scope

天涯浪子 提交于 2019-12-03 08:26:51
We're using ASP.NET and IIS 6.0. I realise that the definitions of applications, websites and virtual directories are ill-defined in IIS 6, and changed a lot in IIS 7. However, I'm stuck with IIS 6.0 for now. We have a single web site defined in IIS, and a number of separate sub-sites in Virtual Directories. The scheme looks like this:- http://site.example.com/site1 http://site.example.com/site2 .. etc .. site1, site2, ... are virtual directories in IIS 6.0, under the "Default Web Site". I need to use ASP.NET sessions and forms authentication in most of these sites, and I don't want them to