开发者

Write a file to desktop of current user in C# asp.net

if i have this code, this creates a problems if other use开发者_如何学Cr that dont have acces to the network share tryes to run the method. How can i make this method write the file to the current users desktop?

        private void skriveTilFil()
        {
            StreamWriter writer = new StreamWriter(@"\\192.168.1.2\tmp\script.vbs");
            writer.WriteLine(scripttbx.Text);

            writer.Dispose();
        }


On client/server web environments, you shouldn't be able to write data directly on client machines.

Can you download some data to your browser and/or run an ActiveXObject installed on client workstation? This can lead to some issues installing components on users machines, but will be more easily developed.


You can do it in an intranet environment by altering permissions/policies. You have to give the appropriate permissions to your ASP.NET application through IIS/Active Directory to the shares.


Browser security prevents this without using a control such as an ActiveX.

Any particular reason you don't just provide a download link?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜