C# - Writing Audit Records Of Pre And Post Values?
Oct 6, 2010
I'm currently using an SqlDataSource in ASP.NET/C# to let users insert, delete and update entries in a table/gridview. Every event needs to be written to an audit table.
I have easily implemented inserting and deleting - when inserting, the main info audited is just the parameter values of the insert query (e.Command.Parameters[0].Value.ToString() etc), and deleting is pretty much the same (just getting the ID in the delete query).
But with updating, I need to log which fields were changed and also their old values. How would I do this? As an example, here is the code for the inserting:
[Code]....
View 2 Replies
Similar Messages:
Aug 24, 2010
I have a web page (Provider) that creates an XML file to be send to the Requester in this fashion:
1. A Requester page needs to send an XML file to the provider page
2. Provider will read the XML file to authenticate the request
3. Provider will Create an xml file with some data.
4. Provider will send the xml file back to the Requester.
Can anyone provide sample code for both the Requestor page (step 1) and the Provider page (steps 2 & 3)
View 1 Replies
Jan 28, 2011
I have a button that when clicked, will generate a PDF and write it out to the response.This is the basic structure of the code:
try
{
using(Stream stream = generatePdf())
{
[code]...
Downloading the file works fine, except that it doesn't complete the postback.If I were to throw an exception above file.Transmit, the error handling would work properly and I would see the message get displayed in my browser. However, if there is an exception after the file.Transmit then nothing happens. The user saves/opens the pdf and the page does not reload.How can I make it so that the postback always completes, that way I can display an appropriate message to the user?
View 2 Replies
Feb 25, 2010
What I have?I have a ASP.NET page which allows the user to download file a on a button click. User can select the file he wants from a list of available files (RadioButtonList) and clicks on download button to download it. (I should not provide link for each file that can be downloaded - this is the requirement).What I want?I want the user to download multiple files one by one by selecting the required radio button and clicking on the button.What problem am I facing?I can download the file for the first time properly. But, after downloading, if I select some other file and click on the button to download it, click event of the button does not post back and the second file will not be downloaded.I use the follwoing code on the button click event:
protected void btnDownload_Click(object sender, EventArgs e)
{
string viewXml = exporter.Export();
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=views.cov");
Response.AddHeader("Content-Length", viewXml.Length.ToString());
Response.ContentType = "text/plain";
Response.Write(viewXml);
Response.End();
}
View 3 Replies
Jun 4, 2010
I am creating an insert statement in my c# code to insert records to an access database table. I am getting the error copied below using c# code. When I copy the generated insert statement from the console and run this on my access database, it succesfully appends a record in the table.Insert statement generated:
insert into [Pet Fish-log 2010] ([Specimen Type], Year, [Lab Number], [Last Name], [First Name], [Middle Initial], Gender, [Date of Birth], [Collection Date], [Date Received], Client, [Tissue Type], [Block Number],
[code]......
View 3 Replies
Mar 7, 2010
Can v create a Write New Post like editor (in which im writing) with ASP.NET controls n without using Java Script that do the following tasks:
Bold, Italic, Underline, Image insertion etc.
View 2 Replies
Jun 11, 2010
I have a checkbox column in a Gridview that I would like to use to insert the value of one cell in the row into an access database. There will be a maximun of five cells allowed to be selected so there can be one value written to one field in the database up to the maximum of the five fields. The access database has five columns: Selection1 ,Selection2, Selection3 ,Selection4 and Selection5
When the checkbox is checked, the value of one cell (PliD) should be written to each field in the database. Ie: checkbox in row 1 should write PliD value to Selection1, checkbox in row 2 should write PliD value to Selection2, checkbox in row 3 should write PliD value to Selection3 and on depending on which checkbox has been checked. I am not sure how to get the value of the checkbox and write it into the corresponding fields in the database.
[Code]....
View 4 Replies
Jun 3, 2010
i just cannot work this out... i have a gridview and when a user clicks on a row the checkbox unchecks itself... when the user clicks the row a sqldatasource.update is called from the selectedindexchanged event, problem is when it writes back to the database it writes back every checkbox as unchecked, i want just the row that's selected...
what i can't work out is i've tried putting a where clause in the sqlcommand which is something like where primarykeyID = gridview1.selectedvalue... now it won't write anything back to the database...!!!
... once i take out the where clause, it writes back to every row..!!
View 9 Replies
Jul 1, 2010
I have an old 1.1 application. I want to add an audit log page which records every page user visits. who are they, which page they visit, and what time and so on. However, I do not want to touch the old code but just add another page to the website. Is it possible?
View 1 Replies
Mar 3, 2011
We have an (asp.net) application that connects to a SQL Server 2008 R2 database using login credentials specifically setup for this application.
Our application access/modifies/deletes records via stored procedures, to which we pass the username of the user performing the action as a parameter.
We need to be able to keep an audit log of all updates and deletes on certain tables. The solution also needs to be as minimal as possible and not require any developer intervention.
The easiest way I can find, is to put a trigger on the table (A) that copies the 'old' data into a history table (A_History) The problem is that we need to be able to tell who performed the action, for an update this is easy we just look at username of the newly inserted record. But for a delete we do not have access to the username parameter sent to the stored procedure.
Is there any way to implement this without using things like CONTEXT_INFO(), because this would need to be added to every stored procedure and every call, which is bound to be forgotten.
View 1 Replies
Jul 13, 2010
We are developing a web application using asp.net and sql server. We are required to do an Audit trail for the application. As I understand this, an audit trail would basically be for all the Inserts, Updates and Deletes on the data base right? Now the way to approach this is that I have an Audit Trail Table in the DB that populates after every insert,update or delete is fired (Manually writing the script within the DAL). However any DB changes directly fired from SQL Management studio will NOT be recorded (for obvious reasons :P).
To cater for that I could create a trigger and that takes care of everything. I also did some googling and found out that SQL server has the ability to do audit trail. However the problem with using triggers is that I will NOT get the user information that logged in the website. I will get the sql user but I dont give two hoots about that, I am concerned about the website user. A solution that I figured out was either
a) Have an audit trail from my web application and also have trigger set up. On the audit report, I simply show an audit log from web application and and audit log from sql server.Obvious problems with this approach: over head. Writing to two different sets of tables on EVERY DB CHANGE.
b) I have a column called UserId ON EVERY DB TABLE. Then I create a trigger to capture all the DB changes. I pass this userId on every table I change (insert,update,delete) and the get this id from the trigger.
Obvious setbacks: unneccesary userid column in every table I do appologize for the long post. Basically I need an audit log that does log all the db changes (including direct hack to db) but at the same times gives me user login information for those db changes that were made FROM the web application.
View 4 Replies
Mar 4, 2011
I want to send some values from my iPhone application to an ASp.Net web page in server. I am using asihttp for that. Its processing the request and invoking the page on server. But the none of the values are retrieved in server side. Below is the code from iPhone app.
NSURL *url = [NSURL URLWithString:urlString];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
[request setPostValue:@"abc" forKey:@"from"];
[code]...
View 2 Replies
Aug 13, 2010
I was woundering if i could be lead in the right direction.
I have three tabs on my page and on the first tab i have a txtbox which i supply with a name. On my tab 2. I have a ddl which i will include the value of the txt i was working on on tab1
Now i will like to post the value on the textbox in tab1 to the ddl in tab2(Searching through it and getting the right info)
The way i have it right now is just adding another value into the ddl and its not searching properly even thou i know there is a record in the db.
View 17 Replies
Jan 24, 2011
i have the same problem like http://forums.asp.net/t/1645052.aspxMODEL
public class StudentModel
{
public int StudentID { get; set; }
[code]...
View 8 Replies
May 24, 2010
I have a question regarding the record audit trail with EF. Recently we have started working on a application that has to have an record audit trail.Just few tables have Guid as PK, the rest of them have Int32 standard Identity setup.
The quick solution we have found is to wire up an event handler on SavingChanges and get all Added, Deleted and Modified records. But the problem is that the Inserted records for the tables that have Int32 as PK are audited with PK value of 0.
the code for the event handler looks like this:
[Code]....
View 2 Replies
Oct 11, 2010
I want to implement audit trail in my project. This implies keeping track of changes made in DB and later generating a report for specific data.
I'm looking for solutions other than triggers as in to have a generic solution for DB Audit trail in my project.
We'll probably be using Entity Framework 4.0. I want to explore the audit trail capabilities for the same any pointers in this directions would be helpful. also any ideas for DB Audit trail if we use Enterprise Library Data Application Block. Note:SQL Server 2008 has auditing features, but we'll not be using the Enterprise version.
View 1 Replies
Mar 11, 2010
I have QuoteNumber(ddquotes.text),partnumber(txtpart),Lastmodifieddate(txtLMD) which is a time stamp on my webform.I am sending all these information to my vendaor as an email with attachment .
When i click on email button a message should be recorded in a Textbox saying so and so quotenumber,so and so partnumber has been sent on ,so and so datetime to so and so vendor.how can i acheive this with single button click.
View 3 Replies
Sep 27, 2010
let's say I have a page with a form on it where a user clicks Submit. This page checks the input fields when the user presses that button. If the fields contain mistakes, the appropriate fields' labels are turned red. That much is easy. Let's say if it's right, I want to POST that form to an external page written in another language. I cannot use any .NET conventions for transferring data, so it must be POST values. The postback attribute would seem to be for this, but I need the forwarding to be conditional. Eg: They're only posted to the external page IF my button handler determines that the values are good.
View 1 Replies
Nov 17, 2010
I Had two webforms. source.aspx & Target.aspxSuorce.aspx has 2 textboxes for input data and two submit buttons. am using cross page technique to transfer data from one webform to other.ource Page:On buton click event :
Server.Transfer("TargetHome.aspx");
= null)
{
TextBox TextBox1 = PreviousPage.FindControl("TextBox1") as TextBox;
if (TextBox1 != null)
[code]...
View 16 Replies
Jun 21, 2010
I have a classic ASP page that requires two values from a form. These values are posted to the ASP page from another pages form. I would like to pass these values to the ASP page without the need for a form for testing. Is this possible?This is what the asp page looks like:
<%@LANGUAGE="JavaScript"%>
<%
var someID = new String( Request.Form("someID") );
var anotherID = new String( Request.Form("anotherID") );
%>
Ideally I would like to have VS pass values to 'someID' and 'anotherID' when debugging is started.
View 4 Replies
May 5, 2010
I have notice that the UpdatePanel post every field included on the form on every trigger.
But in most of my cases I use 2-3 UpdatePanels at the same page, and each one is independent.
When I click for update the one panel, then my page receive all the input data of the page (ok this is logical) but I won to read only this UpdatePanels data and act according, and not the other panels data.
So I see that a lot of traffic is happened this way.
So is there a way to say to one UpdatePanel - send only my input data, and not everything found on the page. ?
View 1 Replies
Apr 7, 2010
I have created a Webpage which will post as "post" method..not as "get" method.
<html>
<head>
</head>
<body>
<FORM action="RetrieveData_Post.asp" id=form1 method=post name=form1>
First Name:
<br>
<INPUT id="txtFirstName" name="txtFirstName" >
<br>
Last Name:
<br>
<INPUT id="txtLastName" name="txtLastName" >
<br>
<INPUT type="submit" value="Submit">
</FORM>
</body>
</html>
i want to retieve the values in the textboxes in the code behind of another form.
View 3 Replies
Jun 9, 2010
I am in the process of creating an audit trail system. Simple enough. Certain fields require audit trail. What is the best design concept to allow this to work in multiple applications without having to change much? I would of course leave it to the admin of the site to add what fields should be audited, but the logic is the problem. Would implementing the interface IComparable be a place to start? My initial thinking is to compare 2 arrays against eachother and do an insert of what fields are in question. Array1 are the fields in the form, array2 are the fields from the sql table that require auditing.
View 8 Replies
Apr 19, 2010
Suppose you have the following... An ASP.NET web application that calls a stored procedure to delete a record. The table has a trigger on it that will insert an audit entry each time a record is deleted. I want to be able to record in the audit entry the username of who deleted the record. What would be the best way to go about achieving this? I know I could remove the trigger and have the delete stored procedure insert the audit entry prior to deleting but are there any other recommeded alternative?
If a username was passed as a parameter to the delete stored procedure, is there anyway to get this value in the trigger that's excuted when the record is deleted? I'm just throwing this out there...
View 4 Replies
Jul 29, 2010
I am using SQL server triggers to do the database auditing for my website. My problem is that I cannot pass the username who manipulate data into the Audit table. The username saved into Audit table is always the SQL server user name which is part of my connection string. Is there any better way to handle this?
View 6 Replies