Sunday, March 25, 2012
Authorization Based on UserId and Parameter Data
I am novice for reporting services.
Is it possible to get the parameters of the report and do authorisation
check based on the parameter value and UserId ?
Or is there other alternative to this kind of requirement..
Thanks,
RaghuHi,
It is possible but not advisable, there is no field mask for the password
field. Best bet is to use custom form for the password authentication.
Amarnath
"RAV" wrote:
> Hi All,
> I am novice for reporting services.
> Is it possible to get the parameters of the report and do authorisation
> check based on the parameter value and UserId ?
> Or is there other alternative to this kind of requirement..
> Thanks,
> Raghu
>
Thursday, March 22, 2012
Authentication not working!
Hey there,
I have a table [user] in a SQLExpress database [Database.mdf] in the App_Data folder. There are two columns. [userId] and [password]. I want to authenticate the user who wants to log in through a Login control. the user should have his userId and password in the [user] table. I digged and made my code. but it doesn't work it keeps giving me that the user is not authenticated. i guess it has no errors. please tell me if you find the error. here is the code:
1protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)2 {3 SqlConnection conExpress =new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Database;Integrated Security=True;User Instance=False");//Create the server connection45try6 {7string id_user = Login1.UserName.Trim();//Get the username from the control8string pass_user = Login1.Password;//get the Password from the control910 //These are a sql and connection Examples11string sql ="SELECT userId, password FROM user WHERE userId = @.param_Id AND password = @.param_Password";12 SqlCommand comSQL =new SqlCommand(sql, conExpress);//Create the sql command using sql string and sql connection1314 //Add the sql parameters15 comSQL.Parameters.AddWithValue("@.param_Id", id_user);//New on VS 2.016 comSQL.Parameters.AddWithValue("@.param_Password", pass_user);1718string cod_user ="";19string name_user ="";2021//Open database connection22 conExpress.Open();23 SqlDataReader dr = comSQL.ExecuteReader();24while (dr.Read())25 {26 cod_user = dr.GetValue(0).ToString();//The coduser is unique onto database table27 name_user = dr.GetValue(1).ToString();28 }29 conExpress.Close();//Close Database Connection30if (cod_user !="")//The user exist onto database31 {32//Create the session vars33 Session["coduser"] = cod_user;34 Session["nameuser"] = name_user;35 e.Authenticated =true;//Grant the access, Goes to DestinationPageUrl36 }37 }38catch(Exception)//On Login Error39 {40 e.Authenticated =false;//Confirm that you are out41 conExpress.Close();//On any error case, close the database connection42 }43 }The way I've used the Login control with custom authentication (without MembershipProvider) is
processing the event of the Login Control:
protected
void Login1_LoggingIn(object sender,LoginCancelEventArgs e)and if the credentials is valid i create the autheentication cookie:
FormsAuthentication.SetAuthCookie(userName,false);
and Redirect to the page user has requested.
If the credentials are wrong I set :
e.Cancel =
true;and
Login1.FailureText =
"Unable to validate credentials";I'm not sure this is the right way of doing that, but it works for me.
Hope this will help you.
Cheers,
Yani
sqlThursday, March 8, 2012
auditing
I want to create audit table with columns (userID, date, tableAffected,
ColumnAffected).
This table should have data from tables that I want to trace. It easy to
collect data about time and users, but I don't know how to collect data abou
t
which table and which column is affected.
So, if i have table employees employeeID,Lastname,Firstname I wolud like to
have 3 record in my Audit table:
uros; 11/11/2005; employees; EmployeeID
uros; 11/11/2005; employees; Lastname
uros; 11/11/2005; employees; Firstname
Do you have any suggestions?Hi,
I wat to give my suggestion here , there might be better suggestions pouring
for this prob. so keep checking,
Create trigger for all ur tables and in triggers use Updated(col_name) to
check whether column got updated or not.
--
Vishal Khajuria
9886170165
IBM Bangalore
"uros" wrote:
> I have another question.
> I want to create audit table with columns (userID, date, tableAffected,
> ColumnAffected).
> This table should have data from tables that I want to trace. It easy to
> collect data about time and users, but I don't know how to collect data ab
out
> which table and which column is affected.
> So, if i have table employees employeeID,Lastname,Firstname I wolud like t
o
> have 3 record in my Audit table:
> uros; 11/11/2005; employees; EmployeeID
> uros; 11/11/2005; employees; Lastname
> uros; 11/11/2005; employees; Firstname
> Do you have any suggestions?|||hi Uros,
You can design a SQL server trace using sql profiler
and save the trace to a file.
for optimum performance. you can run a trace
on another machine which is the standard way of profiling sql server.
in this way your auditing doesn't disturb
the production server
thanks,
Jose de Jesus Jr. Mcp,Mcdba
Data Architect
Sykes Asia (Manila philippines)
MCP #2324787
"uros" wrote:
> I have another question.
> I want to create audit table with columns (userID, date, tableAffected,
> ColumnAffected).
> This table should have data from tables that I want to trace. It easy to
> collect data about time and users, but I don't know how to collect data ab
out
> which table and which column is affected.
> So, if i have table employees employeeID,Lastname,Firstname I wolud like t
o
> have 3 record in my Audit table:
> uros; 11/11/2005; employees; EmployeeID
> uros; 11/11/2005; employees; Lastname
> uros; 11/11/2005; employees; Firstname
> Do you have any suggestions?|||Uros,
I have this design working except I have OldValues and NewValues columns
instead of ColumnAffected. These two columns are for recording affected
columns names and values in an xml style. This allows for having just one
row per action. In addition I have EventType to tell update from insert from
delete and RowID column to link back to the original table record. The work
of writing to the audit table is done in a universal trigger that can be
dropped into a table design with no modifications. In that trigger the
following is user to get the table name:
select object_name(parent_obj)
from sysobjects
where id = @.@.procid
and columns_updated() function output is parsed to get to the columns
affected.
Ilya
"uros" <uros@.discussions.microsoft.com> wrote in message
news:0D4071F5-7445-43E1-B904-B4F43DB020FF@.microsoft.com...
> I have another question.
> I want to create audit table with columns (userID, date, tableAffected,
> ColumnAffected).
> This table should have data from tables that I want to trace. It easy to
> collect data about time and users, but I don't know how to collect data
about
> which table and which column is affected.
> So, if i have table employees employeeID,Lastname,Firstname I wolud like
to
> have 3 record in my Audit table:
> uros; 11/11/2005; employees; EmployeeID
> uros; 11/11/2005; employees; Lastname
> uros; 11/11/2005; employees; Firstname
> Do you have any suggestions?
Friday, February 24, 2012
Attendance information retreival
i need to retreive from a data from a database and show it in a grid. the data is actually a Card Reader database which actually stores the UserId , Date,StartTime,EndTime. the user will have multiple starttime and end time on the same date. My question is how to display the data in ASP.net Grid or datalist or Repeater control like below which will calculate the totl time in a day the user has spent in the office
UserID Date Hours
1 10/06/2007 8
1 11/06/2007 10
1 12/06/2007 9
2 10/06/2007 11
3 12/06/2007 12
3 13/06/2007 10
Note: Atleast youcan give me the SQL Statement for MS SQL Server for this it will be really helpful..
I really apprecaite your continous effort in helping developers in acheiving their target..
Sonu..
Quote:
Originally Posted by Sonu Koshy
Hi,
i need to retreive from a data from a database and show it in a grid. the data is actually a Card Reader database which actually stores the UserId , Date,StartTime,EndTime. the user will have multiple starttime and end time on the same date. My question is how to display the data in ASP.net Grid or datalist or Repeater control like below which will calculate the totl time in a day the user has spent in the office
UserID Date Hours
1 10/06/2007 8
1 11/06/2007 10
1 12/06/2007 9
2 10/06/2007 11
3 12/06/2007 12
3 13/06/2007 10
Note: Atleast youcan give me the SQL Statement for MS SQL Server for this it will be really helpful..
I really apprecaite your continous effort in helping developers in acheiving their target..
Sonu..
try:
select, userId, date, hours, OtherColumnsThatYouWantToInclude from YourTable
where (condition of records that you want to include or exclude)