如何从ASP.NET创建网络共享上的文件 [英] How to create file on network share from ASP.NET

查看:91
本文介绍了如何从ASP.NET创建网络共享上的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在独立运行的ASP.NET应用程序(不是域的一部分)

Windows 2003.我使用表单身份验证为我应用。我需要在Windows域网上共享

驱动器以及通过Samba Unix驱动器共享创建和读取文件,这相当于

写入/读取工作组计算机。如果可能,请指出

详细逐步说明需要做什么。谢谢。


问候,

Hi,

I have ASP.NET application running on standalone (not part of the domain)
Windows 2003. I use forms authentication for my application. The problem I
have is that I need to create and read files on Windows domain network shared
drives and also on shared via Samba Unix drives, which is equivalent to
writing/reading to the workgroup computer. Please point, if possible, to
detailed step by step description of what needs to be done. Thank you.

Regards,

推荐答案

嗨安德烈,


您当然可以使用System.IO类在网络上创建文件

驱动器,就像在本地计算机驱动器上创建文件一样。

如果您愿意,可以使用UNC路径,也可以使用映射驱动器。规则是

相同。唯一的区别是:


1.安全性:使用具有适当

权限的Active Directory域帐户。如有必要,请使用模拟。

2. Unix驱动器:文件本身可能存在一些问题,

,特别是如果它们是文本文件。在Unix

系统上,回车率是不同的。系统可能使用ASCII而不是Unicode文本编码为

井。


-

HTH,


Kevin Spencer

Microsoft MVP

..Net开发人员

太阳永远不会开启

天国


" Andre" <安*** @ discussions.microsoft.com>在留言中写道

新闻:2C ********************************** @ microsof t.com ...
Hi Andre,

You can certainly use the System.IO classes to create files on a network
drive in the same way that you would create them on a local machine drive.
You can use a UNC path if you wish, or a mapped drive. The rules are the
same. The only differences would be:

1. Security: Use an Active Directory domain account with the proper
permissions. Use impersonation if necessary.
2. Unix drives: You may have some issues with the files themselves,
especially if they are text files. Carriage returns are different on Unix
systems. The system may be using ASCII instead of Unicode text encoding as
well.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven

"Andre" <An***@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...


我有独立运行的ASP.NET应用程序(不是域的一部分)
Windows 2003.我使用表单验证我的应用程序。我的问题是我需要在Windows域网上创建和读取文件共享
驱动器以及通过Samba Unix驱动器共享,这相当于
写/读到工作组计算机。如果可能的话,请指出
详细的逐步描述需要做什么。谢谢。

问候,
Hi,

I have ASP.NET application running on standalone (not part of the domain)
Windows 2003. I use forms authentication for my application. The problem I
have is that I need to create and read files on Windows domain network
shared
drives and also on shared via Samba Unix drives, which is equivalent to
writing/reading to the workgroup computer. Please point, if possible, to
detailed step by step description of what needs to be done. Thank you.

Regards,



嗨凯文,


我的问题是我不明白冒充可以帮助我。我的网站

服务器(表示其上的任何帐户)无权读取/写入
共享目录。为我创建的Unix和Windows域管理员

适当的帐户访问共享 - 在Unix上创建用户

asp用密码asp可以访问共享文件夹。从Windows资源管理器
我的电脑上的
我可以使用提供的用户名和

密码连接到此共享文件夹。但是这个用户名和密码来自远程盒子而不是本地

一个,这意味着LogonUser对我不起作用,因为它只能用于
登录本地计算机(至少那是文档所说的)。


你能帮我解决我需要登录另一个盒子的问题

使用另一个盒子''是帐号而不是本地帐号?


非常感谢。

" Kevin Spencer"写道:
Hi Kevin,

My problem is that I don''t understand how impersanation can help me. My web
server (means any accounts on it) does not permissions to read/write to
shared directories. Administrators of Unix and Windows domain created for me
appropriate accounts for access to shares - means on Unix was created user
asp with password asp which can access shared folder. From Windows Explorer
on my PC I can connect to this shared folder using provided username and
password. But this username and password are from remote box not the local
one, which means that LogonUser will not work for me as it can be used only
to login to local computer (at least that is what documentation says).

Could you please help with the issue that I need to login to another box
using another box''es account and not the local one?

Thanks a lot.
"Kevin Spencer" wrote:
嗨安德烈,

您当然可以使用System.IO类在网络上创建文件
驱动器的方式与你可以在本地机器驱动器上创建它们。
如果你愿意,你可以使用UNC路径,或者映射驱动器。规则是相同的。唯一的区别是:

1.安全性:使用具有适当
权限的Active Directory域帐户。如有必要,请使用模拟。
2. Unix驱动器:文件本身可能存在一些问题,特别是如果它们是文本文件。 Unix
系统上的回车不同。该系统可能正在使用ASCII而不是Unicode文本编码。

-
HTH,

Kevin Spencer
Microsoft MVP
..Net开发者
太阳永远不会落在天国

安德烈之上<安*** @ discussions.microsoft.com>在消息中写道
新闻:2C ********************************** @ microsof t.com。 ..
Hi Andre,

You can certainly use the System.IO classes to create files on a network
drive in the same way that you would create them on a local machine drive.
You can use a UNC path if you wish, or a mapped drive. The rules are the
same. The only differences would be:

1. Security: Use an Active Directory domain account with the proper
permissions. Use impersonation if necessary.
2. Unix drives: You may have some issues with the files themselves,
especially if they are text files. Carriage returns are different on Unix
systems. The system may be using ASCII instead of Unicode text encoding as
well.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven

"Andre" <An***@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...


我有独立运行的ASP.NET应用程序(不是域的一部分)
Windows 2003.我对我的应用程序使用表单身份验证。我的问题是我需要在Windows域网上创建和读取文件共享
驱动器以及通过Samba Unix驱动器共享,这相当于
写/读到工作组计算机。如果可能的话,请指出
详细的逐步描述需要做什么。谢谢。

问候,
Hi,

I have ASP.NET application running on standalone (not part of the domain)
Windows 2003. I use forms authentication for my application. The problem I
have is that I need to create and read files on Windows domain network
shared
drives and also on shared via Samba Unix drives, which is equivalent to
writing/reading to the workgroup computer. Please point, if possible, to
detailed step by step description of what needs to be done. Thank you.

Regards,




安德烈。


re:
Hi, Andre.

re:
你能帮我解决一下我需要登录的问题
使用另一个盒子的帐户而不是本地帐户吗?


< identity impersonate =" true"名称= QUOT; domain\user"密码=" pwd" />


应该允许您在冒充

域帐户时运行ASP.NET,该帐户有权读取/写入其他方框。


当然,对于那个,另一个盒子和你的盒子

需要成为同一个域的成员。
< br $>
Juan T. Llibre

ASP.NET MVP
http://asp.net.do/foros/

Foros de ASP.NET en Espa?ol

Ven,y hablemos de ASP.NET ...

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


"安德烈" <安*** @ discussions.microsoft.com>在消息中写道

news:50 ********************************** @ microsof t.com ...嗨凯文,

我的问题是我不明白冒充可以帮助我。我的网站
服务器(表示其上的任何帐户)无权读取/写入共享目录。 Unix和Windows域管理员为我创建
适当的帐户访问共享 - 在Unix上创建用户
asp用密码asp可以访问共享文件夹。从我在PC上的Windows资源管理器
我可以使用提供的用户名和密码连接到此共享文件夹。但是这个用户名和密码来自远程盒子而不是本地用户,这意味着LogonUser对我不起作用,因为它只能用于登录本地计算机(至少这是文档所说的) )。

你能帮我解决我需要登录另一个盒子的问题
使用另一个盒子而非本地帐户吗?

非常感谢。
" Kevin Spencer"写道:
Could you please help with the issue that I need to login to
another box using another box''s account and not the local one?
<identity impersonate="true" name="domain\user" password="pwd"/>

should allow you to run ASP.NET while impersonating the
domain account which has permissions to read/write the other box.

For that, of course, both the other box and your box
need to be members of the same domain.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espa?ol
Ven, y hablemos de ASP.NET...
======================

"Andre" <An***@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com... Hi Kevin,

My problem is that I don''t understand how impersanation can help me. My web
server (means any accounts on it) does not permissions to read/write to
shared directories. Administrators of Unix and Windows domain created for me
appropriate accounts for access to shares - means on Unix was created user
asp with password asp which can access shared folder. From Windows Explorer
on my PC I can connect to this shared folder using provided username and
password. But this username and password are from remote box not the local
one, which means that LogonUser will not work for me as it can be used only
to login to local computer (at least that is what documentation says).

Could you please help with the issue that I need to login to another box
using another box''es account and not the local one?

Thanks a lot. "Kevin Spencer" wrote:


嗨Andre,

你当然可以使用System.IO类来创建文件网络驱动的方式与在本地计算机驱动器上创建它们的方式相同。
您可以根据需要使用UNC路径,也可以使用映射驱动器。规则是相同的。唯一的区别是:

1.安全性:使用具有适当
权限的Active Directory域帐户。如有必要,请使用模拟。
2. Unix驱动器:文件本身可能存在一些问题,特别是如果它们是文本文件。 Unix
系统上的回车不同。该系统可能正在使用ASCII而不是Unicode文本编码。

-
HTH,

Kevin Spencer
Microsoft MVP
..Net开发者
太阳永远不会落在天国

安德烈之上<安*** @ discussions.microsoft.com>在消息中写道
新闻:2C ********************************** @ microsof t.com。 ..
Hi Andre,

You can certainly use the System.IO classes to create files on a network
drive in the same way that you would create them on a local machine drive.
You can use a UNC path if you wish, or a mapped drive. The rules are the
same. The only differences would be:

1. Security: Use an Active Directory domain account with the proper
permissions. Use impersonation if necessary.
2. Unix drives: You may have some issues with the files themselves,
especially if they are text files. Carriage returns are different on Unix
systems. The system may be using ASCII instead of Unicode text encoding as
well.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
The sun never sets on
the Kingdom of Heaven

"Andre" <An***@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...
>
>
>我有独立运行的ASP.NET应用程序(不是域的一部分)
> Windows 2003.我为我的应用程序使用表单身份验证。问题我
>我需要在Windows域网上创建和读取文件
>分享
>驱动器以及通过Samba Unix驱动器共享,相当于
>写/读到工作组计算机。如果可能,请指出
>详细逐步说明需要做什么。谢谢。
>
>问候,
> Hi,
>
> I have ASP.NET application running on standalone (not part of the domain)
> Windows 2003. I use forms authentication for my application. The problem I
> have is that I need to create and read files on Windows domain network
> shared
> drives and also on shared via Samba Unix drives, which is equivalent to
> writing/reading to the workgroup computer. Please point, if possible, to
> detailed step by step description of what needs to be done. Thank you.
>
> Regards,



这篇关于如何从ASP.NET创建网络共享上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆