开发者

StreamWriter Only Works on Some Workstations

开发者 https://www.devze.com 2023-02-01 01:03 出处:网络
I have a page on an intraweb (that I didn\'t create) which allows a user to specify a .txt file and then it writes the results of a SQL stored procedure to the file using StreamWriter.

I have a page on an intraweb (that I didn't create) which allows a user to specify a .txt file and then it writes the results of a SQL stored procedure to the file using StreamWriter.

It apparently stopped working for some of my workstations several months ago, so I can't trace 开发者_运维百科it to any specific changes (However, I know the code itself didn't change).

If I access & use the page on the server (where the wwwroot and applicable database are located), it successfully writes the .txt, whether I specified a local file or on a workstation on the network. Users on some workstations,though, are no longer able to write to a file. (It is also not just writing a blank file. The "Date Modified" remains unchanged.)

The problem seems to be machine-related rather than user-related, as I can login as the same user on different workstations with different results.

I still think it may have something to do with permissions, so I created a .txt on a problem workstation with every possible account having full permissions, but no luck. Permissions on the database, stored procedure, and folder destination seem correct.

Any suggestions welcome, Thanks.


You mean to tell us that the page completes with success, your calls to StreamWriter all succeed, and yet in the end there is no file? I find that really hard to digest. A much more likely hypothesis is that the page fails and exception is thrown. Such an exception would be logged normally in the system event log.

From the description of your symptoms the issue could be a constrained delegation scenario: the page is impersonating the IE user and it cannot flow the credentials to whe accessing the network resource.


It turned out to be the IE security setting "Include local directory when uploading files to a server". This setting is disabled by default.

The working PCs had the setting enabled for some reason. Adding the site as a "Trusted Site" also enables the setting, achieving the same result.

0

精彩评论

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