使用网络凭证连接到路由器USB存储 [英] Connect to router USB storage with network credential

查看:63
本文介绍了使用网络凭证连接到路由器USB存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想连接到一个具有USB存储器关联的路由器.
我想使用该USB存储设备执行IO操作.

我尝试使用UNC连接,但是为此,我需要指定共享名",但在我的情况下,我首先需要在路由器上获取所有共享,然后选择任何一个共享并在该共享上执行IO操作.

我想用网络凭据连接它.

请帮助我.

谢谢,
Vijay

Hello,

I want to connect to one router with has USB storage associated with.
I want to perform IO operation with that USB storage.

I have tried with UNC connection but for that i need to specify "share name", but in my case first i need to get all shares available on router and then pick any one and perform IO operation on that share.

I want to connect it with network credentials.

Please help me on this.

Thanks,
Vijay

推荐答案

Hello,


Finally i have received solution for this.

First we need to connect to network using IP address only and get available shares then concat ip-address and share name and perforam IO operation.
 string filePath = @"\\<Ip Address>";
                string response = WindowsNetworking.ConnectToRemote(filePath, "<username>", "<password>", false);
                Console.WriteLine(response);
                ShareCollection sc = ShareCollection.GetShares(filePath);

                foreach (Share item in sc)
                {
                    if (item.ShareType == ShareType.Disk)
                    {
                        WindowsNetworking.ConnectToRemote(item.Root.ToString(), "<username>", "<password>", false);
                        foreach (var file inDirectory.GetFiles(item.Root.ToString()))
                        {
                            //Get list of files
                        }
                    }
                } Vijay
--------------------------------------------------------------------------------

vijay patel


这篇关于使用网络凭证连接到路由器USB存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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