Visual InterDev
This sample uses user authentication to post and receive messages from other users that have access to this page.
Note For the sample to work properly, you must turn off Anonymous access to the UserNote directory. This can be done using the Microsoft Management Console. Right-click on the UserNote directory in the Gallery project and select Properties. Authentication control can be adjusted using the Directory Security tab in the Properties dialog.
This sample uses three files: UserNote.asp, DelNote.asp and SendNote.asp.
UserNote.asp uses a recordset control and a data-bound grid control to display messages that have been posted for the user.
The messages are retrieved from the UserNote table in the Gallery database. The recordset queries the table to find any messages for the current user. Below is the SQL statement used to achieve this:
function DTCRecordset1_onbeforeopen() {
newSQL = "Select * FROM UserNote WHERE (TO = '" + Request.ServerVariables("AUTH_USER") + "')";
DTCRecordset1.setSQL(newSQL);
}
If there are no messages for the current user, the grid is not displayed and there is only a link to send messages. If there are messages for the current user they are displayed in the grid. The grid displays the message text as well as who the message is from. There is also an option to delete each message.
DelNote.asp is called when the user wants to delete a particular message. The ID number of the message is passed to DelNote.asp and the corresponding record is deleted from the database. After the message is deleted the user is redirected back to the UserNote.asp page.
SendNote.asp uses data-bound controls in conjunction with the FormManager control to store user input into the UserNote table.
There are two controls that accept input: a textbox control denotes who the message is being sent to and a text area control contains the message.
When addressing the message to another member of your organization you must enter both the domain and user name (such as, Domain1\User1). This address is not case sensitive. In this example the message is limited to 255 characters.