Running a local exe as Partially trusted.

  • Thread starter Thread starter Scott Meddows
  • Start date Start date
S

Scott Meddows

Is there an easy way for me to add something in my source code to give my
code only partially trusted access so I can debug it?

Thanks.

Scott
 
You can try to write another small app to load your original application in
a domain.

The code of that app looks like:

Imports System.Security
Imports System.Security.Permissions
Imports System.Security.Policy

Sub Main(ByVal CmdArgs() As String)
If CmdArgs.Length <> 2 Then Return
Dim AppPath As String = CmdArgs(0)
Dim CodeBase As String = CmdArgs(1)

Dim e As New Evidence()
e.AddHost(New Url(CodeBase))
e.AddHost(Zone.CreateFromUrl(CodeBase))
e.AddHost(Site.CreateFromUrl(CodeBase))

Dim ad As AppDomain = AppDomain.CreateDomain("TestHost")
ad.ExecuteAssembly(AppPath, e)
AppDomain.Unload(ad)
End Sub

==

Lifeng
MS VB
 
Back
Top