i just make a application simple and there is a exe executive file from bin folder of project i copy and past in another computer for run it some time it is run application and some times shows this error please guide me where is i am missing or any setting
this is vb.net and web form application not as.net
What I have tried:
application attempted to perform an operation not allow by the security policy . to grand this application the required permission contact your system administrator or use the Microsoft framwork configuration tool.
if you are continue the application will ignore this error and attempted to continue if you will quit the application will close immediately .
request registry access is not allowed .
Imports Microsoft.Win32
Public Class Form1
Public trailtime As DateTime
Dim VALUE As String
'Public trailtime As DateTime
Dim exePath As String = Application.ExecutablePath()
Dim appPath As String = Application.StartupPath()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' MsgBox(exePath)
' MsgBox(appPath)
txtapplicationrunpath.Text = appPath + "\file.exe"
' Try
Dim regStarUP As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN", True)
regStarUP.GetValue(IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath.ToString))
VALUE = regStarUP.GetValue(IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath.ToString))
If Not VALUE = Nothing Then
If My.Settings.checkbox = True Then
'Me.WindowState = FormWindowState.Minimized
' NotifyIcon1.Icon = SystemIcons.Application
'NotifyIcon1.BalloonTipText = "thi is minimize"
'NotifyIcon1.ShowBalloonTip(1000)
' Me.ShowInTaskbar = False
Visible = False
ShowInTaskbar = False
' MyBase.OnLoad(e)
End If
Else
Visible = True
ShowInTaskbar = True
End If
If My.Settings.status = False Then
'Not My.Settings.check Then
'My.Settings.check = True
My.Settings.status = True
trailtime = DateTime.Now
My.Settings.expiringdate = Nothing
Else
If My.Settings.expiringdate > DateTime.Now Then
'My.Settings.mydate.Add(New TimeSpan(22, 0, 0, 0)) > DateTime.Now Then
'MsgBox("active")
Else
System.Diagnostics.Process.Start(My.Settings.apppath)
'MsgBox("exried")
End If
End If
txtremaingdays.Text = My.Settings.expiringdate
Label2.Text = My.Settings.apppath
'Label1.Text = Application.ExecutablePath.ToString
' Catch ex As Exception
' End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'OpenFileDialog1.Filter = "EXE FILE|*.EXE|JPEG FILE|*.JPEG|JPG FILE|*.JPG"
'If OpenFileDialog1.ShowDialog = DialogResult.OK Then
' txtapplicationrunpath.Text = OpenFileDialog1.FileName
'Else
' MsgBox("PLEASE SELECT FILE", MsgBoxStyle.Information
'End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If CheckBox1.Checked = True Then
My.Settings.checkbox = True
ElseIf CheckBox1.Checked = False Then
My.Settings.checkbox = False
End If
If txtapplicationrunpath.Text = "" Or TextBox1.Text = "" Then
MsgBox("Please Browse File Name Not Allow Blank")
Else
Dim regStarUP As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\RUN", True)
regStarUP.GetValue(IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath.ToString))
VALUE = regStarUP.GetValue(IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath.ToString))
If VALUE = Nothing Then
'If regStarUP.GetValue(Label1.Text) = Nothing Then
'If VALUE <> Application.ExecutablePath.ToString Then
regStarUP.SetValue(IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath.ToString), Application.ExecutablePath.ToString)
'regStarUP.Close()
MsgBox("WRITE COMPLETE :")
My.Settings.apppath = txtapplicationrunpath.Text
Else
Dim result = MsgBox("do you want to delete old registry key file ", MsgBoxStyle.YesNo)
If result = MsgBoxResult.Yes Then
regStarUP.DeleteValue(Application.ProductName, True)
ElseIf result = MsgBoxResult.No Then
MsgBox("YOUR OLD FILE IS SAME AS IT WAS THANKS ")
End If
End If
My.Settings.expiringdate = DateTime.Now.AddDays(TextBox1.Text)
End If
End Sub
End Class