开发者

Isolated storage File saving on the Default User Profile for a web service

开发者 https://www.devze.com 2023-01-06 16:38 出处:网络
My problem is The following: I have a windows application that stores a file on the current user\'s isolated storage, lets call this user Adam.

My problem is The following:

I have a windows application that stores a file on the current user's isolated storage, lets call this user Adam.

On the same machine I have a Web service (The Web Service's application pool is running with Adam's credentials) that uses the same dll to access the file on the isolated storage but it is trying to access a file on the Default User开发者_运维百科's profile instead of the real user's profile (in this case Adams Profile)

Why is it trying to look for the file on the Default User's profile Instead of Adam's Profile? How can i make it look for the file in the right profile?.

I'm running it on Win 2003, C# and .Net framework 3.5

Thanks.


AS i was runnig the code on a diferent thread, the credetials where not set for that thread, so all i have to do was to impersonate the main's thread identity and that works. It should look like this

using (System.Security.Principal.WindowsIdentity.GetCurrent().Impersonate())
     {
       //Consult the isolated storage here
     }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号