The code page I am using Visual Basic language and I tried the following function:
Imports System.Diagnostics
Public Class _default
Inherits System.Web.UI.Page
Protected Sub GridView2_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GridView2.RowDataBound
Try
If e.Row.RowType = DataControlRowType.DataRow Then
Dim hLPath As LinkButton = TryCast(e.Row.FindControl("hlApps"), LinkButton)
Dim lblApp As Label = TryCast(e.Row.FindControl("lblAppName"), Label)
Dim lblGrp As Label = TryCast(e.Row.FindControl("lblGroup"), Label)
Dim lblCod As Label = TryCast(e.Row.FindControl("lblCode"), Label)
Dim p As Process = New Process()
If IsInGroup(lblGrp.Text.Trim()) Then
If IsDuplicate(lblCod.Text) Then
e.Row.Visible = False
Else
e.Row.Visible = True
p.StartInfo.FileName = hLPath.Text.Trim() '-----> Cant get the linkbutton to execute on click
p.Start()
End If
Else
e.Row.Visible = False
End If
End If
Catch ex As Exception
End Try
End Sub
Public Function IsInGroup(ByVal GroupName As String) As Boolean
Dim MyIdentity As System.Security.Principal.WindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent()
Dim MyPrincipal As System.Security.Principal.WindowsPrincipal = New System.Security.Principal.WindowsPrincipal(MyIdentity)
Return MyPrincipal.IsInRole(GroupName)
End Function
Private Function IsDuplicate(ByVal appName As String) As Boolean
Dim result As Boolean
result = (From x In appNames Where x = appName
Select x).Any()
If Not result Then
appNames.Add(appName)
End If
Return result
End Function
End Class
Is it not possible with the linkbutton in the GridView RowDataBound?
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim p As Process = New Process()
p.StartInfo.FileName = "notepad.exe"
p.Start()
End Sub
It seems like it works using an click event because your development machine is both the client and server. Once deployed to a server the code will no longer work as the code will try to open notepad on the server,
It is not possible to open local resource with a link due to browser security. Browser do not allow a remote web server to access files on the client machine. If this security measure was not in place web server could grab whatever file they wish from
user machines.
Member
24 Points
132 Posts
How can I open an EXE application from a hyperlink control through IE11 browser?
Apr 24, 2018 06:06 AM|Matt99|LINK
I have an MSSQL database table with the following information:
From the ASP.net page:
The code page I am using Visual Basic language and I tried the following function:
I appreciate any help and thanks in advance.
All-Star
37131 Points
14995 Posts
Re: How can I open an EXE application from a hyperlink control through IE11 browser?
Apr 24, 2018 10:19 AM|mgebhard|LINK
It is not possible to open a local resource with a link due to browser security.
Member
24 Points
132 Posts
Re: How can I open an EXE application from a hyperlink control through IE11 browser?
Apr 24, 2018 10:36 AM|Matt99|LINK
I am able with the button event on click.
Is it not possible with the linkbutton in the GridView RowDataBound?
All-Star
37131 Points
14995 Posts
Re: How can I open an EXE application from a hyperlink control through IE11 browser?
Apr 24, 2018 10:48 AM|mgebhard|LINK
It seems like it works using an click event because your development machine is both the client and server. Once deployed to a server the code will no longer work as the code will try to open notepad on the server,
It is not possible to open local resource with a link due to browser security. Browser do not allow a remote web server to access files on the client machine. If this security measure was not in place web server could grab whatever file they wish from user machines.
Member
24 Points
132 Posts
Re: How can I open an EXE application from a hyperlink control through IE11 browser?
Apr 24, 2018 10:54 AM|Matt99|LINK
Good point.
Probably no solution at this point.