i am software developer my client want to access exchange server users data through web application

I create asp.net application on the same machine where exchange server is install

the follwoi8ng code ,applied in application

================================================

Dim cURL As String

Sub FindMsgsFrom(ByVal sender, ByVal Conn)

Const adErrNoCurrentRecord = 3021
Dim FolderURL As String
FolderURL = "Inbox"
Dim strq As String
Dim rs As ADODB.Recordset
rs = CreateObject("ADODB.Recordset")

'construct the SQL query, note the scope for deep traversal
strq = "SELECT ""urn:httpmail:subject"" "
strq = strq & "FROM scope('shallow traversal of """ & FolderURL & """ ')"
' strq = strq & "WHERE ""urn:schemas:httpmail:sendername"" = '" & sender & "'"

rs.Open(strq, Conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly, -1)

'If empty recordset, return error
'If successful call DoResults routine passing the recorset
If rs.EOF = True Then
On Error Resume Next
Err.Raise(adErrNoCurrentRecord)
Response.Write("No items found, run another query.")
Else
Response.Write("Success! Found " & rs.RecordCount)
DoResults(rs)
End If
rs.Close()

End Sub

Function DoResults(ByVal Rs As ADODB.Recordset)
'If empty recordset, return error
Dim f As ADODB.Field
If Rs.EOF = True Then
'On Error Resume Next
'Err.Raise(adErrNoCurrentRecord)
Response.Write("<br><FONT FACE=Arial SIZE=2>No items found, run another query.<p>")
Else
Rs.MoveFirst()
Do Until Rs.EOF
'Create a HTML table for each record, make table headings stand out
Response.Write("<FONT FACE=Arial SIZE=2><TABLE BORDER=1 cellpadding=5 cellspacing=5>")
Response.Write("<TR><TH bgcolor=#0000ff><FONT color=#ffffff>Property</TH>")
Response.Write("<TH bgcolor=#0000ff><FONT color=#ffffff>Value</TH></TR>")

For Each f In Rs.Fields
'for every field in the record
Response.Write("<TR><TD><FONT SIZE=1>")
Response.Write(f.Name)
Response.Write("</TD><TD><FONT SIZE=1>")

'accommodate null and multivalued properties
If Not IsDBNull(f.Value) Then
If IsArray(f.Value) Then
'a multivalued property
Dim V
For Each V In f.Value
On Error Resume Next
Response.Write(V & "<br>")
Next
Else
On Error Resume Next
Response.Write(f.Value)
End If
Else
'Field is null
Response.Write("Null")
End If
Response.Write("</TD></TR>")
Next
Response.Write("</TABLE><br><hr><br>")
Rs.MoveNext()
Loop
End If
End Function



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Finds items from a sender, searching subfolders
'Passes search result recordset to DoResults (see Enumerating Results)

'get computer and domain information
'info = CreateObject("ADSystemInfo")
'infoNT = CreateObject("WinNTSystemInfo")
'cName = infoNT.ComputerName
'dName = info.DomainDNSName

'create connection object
' Try

Dim conn As ADODB.Connection
conn = CreateObject("ADODB.Connection")
conn.Provider = "Exoledb.DataSource"

'URL for connection object
'is at the virtual directory root
cURL = "http://domain/exchange/shanawazpatel/"

conn.Open(cURL, "", "", -1)

'relative URL is the folder to search
'relURL = "Reports"

sender = "Jane Clayton"

FindMsgsFrom(sender, conn)
' Catch ex As Exception
' Response.Write(ex.Message)
' End Try


End Sub

=================================================

i am getting error
the error will display as below

Server Error in '/MailApplication' Application.
--------------------------------------------------------------------------------

Permission denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Permission denied.

Source Error:


Line 256: ' strq = strq & "WHERE ""urn:schemas:httpmail:sendername"" = '" & sender & "'"
Line 257:
Line 258: rs.Open(strq, Conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly, -1)
Line 259:
Line 260: 'If empty recordset, return error


Source File: \\domain\wwwroot\MailApplication\ExchangeUsingADO.aspx.vb Line: 258

Stack Trace:


[COMException (0x80040e09): Permission denied.]
ADODB.RecordsetClass.Open(Object Source, Object ActiveConnection, CursorTypeEnum CursorType, LockTypeEnum LockType, Int32 Options) +0
MailApplication.ExchangeUsingADO.FindMsgsFrom(Object sender, Object Conn) in \\domain\wwwroot\MailApplication\ExchangeUsingADO.aspx.vb:258
MailApplication.ExchangeUsingADO.Button1_Click(Object sender, EventArgs e) in \\domain\wwwroot\MailApplication\ExchangeUsingADO.aspx.vb:350
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
=============================================================

can any body give me solution

can any setting need for iis or exchange server

or any other solution
please help me out