Seal Report Forum
»
General
»
General Discussions/Other
»
Basic authentication with external db mssql
Rank: Newbie
Groups: Registered
Joined: 9/25/2017(UTC) Posts: 0 Location: Turin
|
Hi there,
i'm new to Seal Report but i can say its a great product!
Seal reports are used by intranet users already logged on intranet-system. I call Seal web application (eg. Seal/Main) from a front-end program (which is resident into Seal virtual dir). That FEP create Session() with intranet userid. The goal is fill the Seal login authentication panel with the login name passed via Session().
Here the basic authentication routine. It work fine but i wish pre-fill WEBUSERNAME with a name coming from DB.
Thank you.
@using System @using Seal.Model @using System.Data @using System.Data.OleDb @using Seal.Helpers @using System.Web @using System.Web.Routing; @using System.Collections.Generic @using System.Data.SqlClient @{ SecurityUser user = Model; user.Name = user.WebUserName; //Display name string utente = user.WebUserName.ToUpper(); string password = user.WebPassword.ToUpper();
string connectionString = "Provider=SQLOLEDB; Data Source=192.168.0.137,1433; Persist Security Info=True; Initial Catalog=INTRANET; User Id=xxxxx; Password=xxxxxx;"; OleDbConnection connection = new OleDbConnection(connectionString); connection.Open(); string sql = "select dwh from alfaomega left join userlist on userlist.id = alfaomega.id where upper(userlist.name) = '" + utente +"'"; sql = sql + " And upper(userlist.password) = '" + password +"'"; OleDbCommand command = new OleDbCommand(sql, connection); string dwh = Convert.ToString(command.ExecuteScalar()); if(dwh == "") { dwh = "NO"; } command.Dispose(); connection.Close(); switch(dwh) { case "NO": throw new Exception("Utente non autorizzato"); break; default: user.AddSecurityGroup(dwh); break; }
var usr = user.AuthenticationSummary;
System.Web.HttpContext.Current.Session["utente"] = ""; if(usr.Contains("User login name:")) { usr = usr.Substring(usr.IndexOf("User login name:")+17); usr = usr.Substring(0,usr.IndexOf("User display name:")-1); System.Web.HttpContext.Current.Session["utente"] = usr.ToUpper(); } }
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 9/25/2017(UTC) Posts: 0 Location: Turin
|
Hi folks, anyone can help me about read a outside session("userid") value for use it on sql select? Thanks
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Your question is not so clear...what is really your problem...Webusername comes from the login window.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 9/25/2017(UTC) Posts: 0 Location: Turin
|
hi, i"ll explain the scenario. a session('xxx") string contain the user name that I wish use for login. need populate webusername before show the panel login. that filled only the webusername, user must only type the password.
thankyou.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Ok, I understand, you have to modify JavaScript omn client side to achieve this, either you store the username in a Cookie on your browser and you reuse it when displaying the Login window OR you call the Server (using a new call or perhaps enhancing GetProfile ?) to get the name to display in the Login Window
You won't be able to do that through the Login Script...
Good luck.
|
|
|
|
Seal Report Forum
»
General
»
General Discussions/Other
»
Basic authentication with external db mssql
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.