Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
ASP .Net
Security Context of Background Thread
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Matt, post: 2761358"] I've written a class that allows me to add documents to a SharePoint Document Library from another web application. The web app runs under a domain account that has permissions to SharePoint. However, when I try to do this from a background thread it fails with Access Denied. I've tested the WindowsIdentity from the background thread and it is the same. Are background threads not running in the same security context under ASP.NET 2.0? Following is my code, Button1 works, Button2 does not. protected void Button1_Click(object sender, EventArgs e) { SPDocLibDataAccess da = new SPDocLibDataAccess("http:// staff.mcrcsip.org", ""); da.AddDocument("D:\\Temp\\LicensedVehiclesDetailReport.pdf", "Shared Documents"); this.lblMessage.Text = "Done!"; } protected void Button2_Click(object sender, EventArgs e) { ThreadStart ts = new ThreadStart(this.UploadFile); Thread t = new Thread(ts); t.Start(); this.lblMessage.Text = "Started thread."; } private void UploadFile() { SPDocLibDataAccess da = new SPDocLibDataAccess("http:// staff.mcrcsip.org", ""); da.AddDocument("D:\\Temp\\LicensedVehiclesDetailReport.pdf", "Shared Documents"); } [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
ASP .Net
Security Context of Background Thread
Top