Current filter:
                                You should refresh the page.

                                You are using an older version of the DevExpress Support Center.

                                  • Hi)

                                    I use XAF + ".Web" + ".Win"+security-system.

                                    I create two users: Admin and Reporter.

                                    I use Admin for Import data in app and other operation with data.

                                    Reporter have right only view reports\dashboard.

                                    I wish use ".Web" like web site. Show only reports. When user go in link he not need use autorization. How I can use autologon (always user Reporter) in .Web? 

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,

                                Create a custom authentication that doesn't show the login window and always logs users in with the same username to accomplish this task. The following thread will help you with this: T234465 - How to skip authentication and automatically redirect a user to the New Password dialog by a link from email.

                                Let me know your results.

                                Thanks,
                                Andrey

                                • MRTProject 01.17.2020

                                  I cant repeat this operation it. Project so old to converting. And have error. I add some code, but ... not work

                                  1. Create new Class in .Web "CustomAuthentication"
                                  [C#]
                                  public class CustomAuthentication : AuthenticationStandard { private bool IsUserExists() { if (string.IsNullOrEmpty(UserName)) { return false; } using (IObjectSpace objectSpace = Application.CreateObjectSpace(UserType)) { return FindUser(objectSpace) != null; } } private IAuthenticationStandardUser FindUser(IObjectSpace objectSpace) { if (string.IsNullOrEmpty(UserName)) { return null; } return (IAuthenticationStandardUser)objectSpace.FindObject(UserType, new BinaryOperator("UserName", UserName)); } private string UserName { get { return HttpContext.Current.Request.Params["id"]; } } public override bool AskLogonParametersViaUI { get { if (IsUserExists()) { return false; } return base.AskLogonParametersViaUI; } } public override object Authenticate(IObjectSpace objectSpace) { IAuthenticationStandardUser user = FindUser(objectSpace); if (user != null) { user.ChangePasswordOnFirstLogon = true; objectSpace.CommitChanges(); return user; } return base.Authenticate(objectSpace); } public XafApplication Application { get; set; } }
                                  2. update WebApplication.cs in .Web
                                  [C#]
                                  public partial class rollerruAspNetApplication : WebApplication { ... private rollerru.Web.CustomAuthentication customAuthentication1; public rollerruAspNetApplication() { InitializeComponent(); //InitializeDefaults(); this.LinkNewObjectToParentImmediately = false; this.customAuthentication1.Application = this; } private void InitializeComponent() { this.customAuthentication1 = new CustomAuthentication(); this.securityStrategyComplex1.Authentication = this.customAuthentication1;//this.authenticationStandard1;
                                  3. update Global.asax in .Web
                                  [C#]
                                  protected void Session_Start(Object sender, EventArgs e) { WebApplication.Instance.Setup(); ((AuthenticationStandardLogonParameters)SecuritySystem.LogonParameters).UserName = "report"; ((AuthenticationStandardLogonParameters)SecuritySystem.LogonParameters).Password = ""; WebApplication.Instance.Start();
                                • Anatol (DevExpress Support) 01.17.2020

                                  This code checks the Id request parameter:

                                  [C#]
                                  private string UserName { get { return HttpContext.Current.Request.Params["id"]; } }

                                  With this implementation, the user is automatically logged on when a correct user name is specified in the request URL. For example: "www.domain.com/Login .aspx?id=report". Did you specify this parameter in your tests? If so, please put breakpoints into CustomAuthentication's AskLogonParametersViaUI and Authenticate members to see how their code is executed in your project.
                                  If you want to use the "report" user name by default, change the CustomAuthentication class accordingly. To get the user name from AuthenticationStandardLogonParameters, use the AuthenticationBase.LogonParameters property.
                                  If this does not help, please provide a sample project demonstrating the issue.

                                • MRTProject 01.18.2020

                                  Ya, i want to use the "report" user name by default and skip skip authentication.

                                  But I like the entrance with the name.

                                  1. I start VS F5, and replace link to

                                  http://localhost:2064/Login.aspx?id=report

                                  2) breakpoints

                                  [C#]
                                  return HttpContext.Current.Request.Params["id"]

                                  return "report"

                                  3. but progrmm not autologon(

                                  Add  sample project. zip (TestAutoLog.jpg - setting reole\user)

                                • MRTProject 01.18.2020

                                  it took 5 manute and I think I understand. If i do like this

                                  [C#]
                                  public override bool AskLogonParametersViaUI { get { return !base.AskLogonParametersViaUI; } }

                                  its work O_o...
                                   

                                • Uriah (DevExpress Support) 01.20.2020

                                  Hello,

                                  I am happy to hear that you have managed to find a working solution. You can even return the false value if you do not want to display the Logon window at all:

                                  [C#]
                                  public override bool AskLogonParametersViaUI { get { return false; } }

                                  Let us know if you have additional questions in this regard.