首先,我會說我挖了一半的互聯網爲這個和無處不在,我發現:「不,你不能它是網絡瀏覽器的安全性」。
我需要這個ASP的Intranet網頁。 NET MVC5 + C#。 應允許用戶在某種對話框中選擇文件或文件夾。然後選擇時,我想找回所選項目的路徑[也是網絡驅動器上的文件或文件夾。但是,而不是映射路徑像z:\ ...我更喜歡\\ Server50 \文件夾\ folder2 \ file.ext]
然後,我想發送此路徑到SQL DB的一些操作。 (這很容易)
這就是我想要完整的UNC路徑的原因。沒有要上傳的文件。
任何人都可以給我一些線索在哪裏尋找或開始?C#MVC獲取完整文件路徑
1
A
回答
0
所以它現在是可能的內聯網用途]
我用MVC + Silverlight的+證書在客戶端
添加Silverlight項目到Visual Studio解決方案:在MVC應用程序項目 -
right-click
>Properties
SilverLight Application tab
- >Add...
:
-check Copy to configuration specific folder
-uncheck Add a test page...
-ch的eck enable Silverlight debugging
銀光:在.xaml.cs主頁:
public MainPage()
{
InitializeComponent();
LayoutRoot.Drop += new DragEventHandler(drop);//important to add
}
private void drop(object sender, DragEventArgs e)
{
if (e.Data!=null)
{
FileInfo[] files = e.Data.GetData(DataFormats.FileDrop) as FileInfo[];
foreach(var item in files)
{
//fullpath in: item.Fullname property
}
}
}
在XAML主網頁設計
<Grid x:Name="LayoutRoot" Background="#FFBF6666" AllowDrop="true">
<Button x:Name="button" Content="Button" HorizontalAlignment="Left" Margin="72,38,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/>
</Grid>
right-click
Silverlight的項目 - >Properties
Signing
tab->檢查Sign the xap file
- >在MVC應用程序Create the test certificate
查看設置:
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<div id="silverlightControlHost">
<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="1000" height="800">
<param name="source" value="/ClientBin/System.xap" />
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="5.0.61118.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.0" style="text-decoration:none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none" />
</a>
</object>
</div>
</asp:Content>
重建兩個項目
部署到生產服務器
在...trusted root authorities
安裝在客戶端創建的證書現在是工作;]
我看到一些人將.xap,.xaml擴展名添加到web.config中,但對我來說卻沒有幫助。
相關問題
- 1. 獲取文件的完整路徑C
- 2. GWT FileUpload獲取文件完整路徑
- 3. 獲取文件的完整路徑
- 4. 從GtkTreeView獲取完整文件路徑
- 5. 獲取S3完整路徑文件
- 6. 從完整路徑獲取文件名
- 7. 從C#中的進程獲取文件的完整路徑?
- 8. C++獲取目錄中文件的完整路徑
- 9. 從C++獲取python可執行文件的完整路徑
- 10. C++如何在IUIAutomation級別獲取文件的完整路徑?
- 11. 從C++中獲取文件名的完整路徑
- 12. 從打開的文件獲取完整路徑 - C#
- 13. 如何在C#中使用Path.GetFullPath獲取文件完整路徑
- 14. 使用文件上傳控件獲取完整文件路徑
- 15. 如何在asp.net mvc 3中獲取FilePathResult文件的完整文件路徑?
- 16. MVC:如何從文件輸入字段獲取完整文件路徑?
- 17. 獲取完整的路由路徑
- 18. 從完整文件路徑獲取文件夾名稱
- 19. javascript複製輸入文件並獲取完整文件路徑
- 20. Ruby文件完整路徑
- 21. 獲取文本文件或c#中的任何文件的完整路徑
- 22. 使用FileUpload控件獲取文件的完整路徑
- 23. 從HTTP請求獲取完整路徑
- 24. 在WPF treeview中獲取完整路徑?
- 25. Powershell獲取完整路徑信息
- 26. Javascript:獲取目錄的完整路徑
- 27. 如何從t:inputFileUpload獲取完整路徑?
- 28. mvc3獲取完整路徑使用HttpPostedFileBase
- 29. 如何獲取StreamWriter的完整路徑
- 30. bookmarklet獲取圖像的完整路徑
檢查https://msdn.microsoft.com/en-us/library/system.io.path.getfullpath(v=vs.110).aspx –
正如您已經在互聯網的一半上發現的那樣,爲了安全原因,你試圖實現的是不可能的。您可以在客戶端計算機上使用專有的ActiveX安裝組件來實現此目的。 –
我不相信「不可能」的情況。如果有這麼多人問這個問題,那就必須有一個解決方案。我將搜索ActiveX解決方案。 – Lukasz