Hi all,
I have M:\PDF-Images\List-PDF drive on the Server with thousands of images stored.
On the M drive has folder:
M:\PDF-Images\List-PDF\4540\4539532.pdf
 4539533.pdf
 4539534.pdf
 4539537.pdf ...
How to access to the folder drive by using VB.NET or C# in the code-behind (securely: with username and password) for the users to be able to view images on the popup window?
See the code :
 
Protected Sub BtnServerDrive_Click(sender As Object, e As EventArgs) Handles BtnServerDrive.Click
Dim PartNumber As String = txtPartNumber.Text.Trim()
'Calculate the folder 4540 like container
Dim NumContainer as string = txtPartNumber.Text.Trim()
NumContainer = (txtPartNumber.Text.Trim / 1000 + 1).toString.Split(".").First
Dim Mdrive as String = (Convert.ToString("http://serverName/PDF-Images/List-PDF?Container=" & NumContainer & "&Name=" & partnumber & ".pdf"))   
Dim GenerateURL As String = GetFinalRedirectedUrl(ServerDriveURL)
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "Key", "NewWindow=window.open(' " + GenerateURL + "','PDFViewer','menubar=0, location=1, toolbars=1, scrollbars= 1, resizable=1, width=750,height=775, top=150, left=220')", True)
End Sub
Public Function GetFinalRedirectedUrl(url As String) As String
       Dim location As String = String.Copy(url)
       Dim responsefromServer As String = String.Empty
      If Not String.IsNullOrEmpty(location) Then
         Dim ServerDriveReq As HttpWebRequest = DirectCast(WebRequest.Create(location), HttpWebRequest)
         ServerDriveReq.AllowAutoRedirect = False
     Using ServerDriveResponse As HttpWebResponse = DirectCast(ServerDriveReq.GetResponse(), HttpWebResponse)
 
     Dim ServerDrivedataStream As Stream
         ServerDrivedataStream = ServerDriveResponse.GetResponseStream()
     Dim reader As New StreamReader(ServerDrivedataStream)
         responsefromServer = reader.ReadToEnd()
     End Using
            End If
            Return responsefromServer
End Function
How to achieve this results to access to the server drive to get images for view by using VB.NET or C# in code-behind. Servermappath, UNC, or else?
Your help and directions are very appreciative. Thanks.