Ask a Question related to ASP.NET General, Design and Development.
-
Woland #1
Access to Application object from exe
Hi,
I have many virtual directory with my web app. I'd like to create one exe
appliaction to administrating these web apps. Is it possible to access
Application object of web appliaction from exe appliaction?
With regards,
Woland
Woland Guest
-
Application Object
How easy is it for a hacker to access data stored in the Application Object in IIS server. I want to store a decrpyted connection string there rather... -
HELP! "Access is denied to this object." - Server object error 'ASP 0178 : 80070005'
Hi, When I try to do Server.CreateObject on an activeX DLL, I receive the following message: ''''''''''''''''''''''' Server object error 'ASP... -
What issue will HIT me hard when I convert an Access 2002 MDE application to Web Application?
Hi All, Current Access 2002 MDE application: - has no tier - has neither business object nor any kind of object (Except MS Form object and... -
Access denied when creating Access application object
In an ASP file I am running the following in VBScript in order to extract data from an Access 2002 MDB file which is physically located in the... -
How to access the application-object to lock it from session?
Hi, You try to access non static member from static function. Use HttpContext.Current.Application.Lock (); to solve your situation. Natty... -
Natty Gur #2
Re: Access to Application object from exe
As far as I know you cant. If you want i got an example that let you
access all AppDomaines (Applications) from ASP.NET page.
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Woland #3
Re: Access to Application object from exe
"Natty Gur" <natty@dao2com.com> wrote in message
news:e1FYAxxPDHA.3016@TK2MSFTNGP10.phx.gbl...I'd be very grateful if you send me this app or link to the page where I can> As far as I know you cant. If you want i got an example that let you
> access all AppDomaines (Applications) from ASP.NET page.
>
> Natty Gur, CTO
look at it.
Thanks in advance,
Woland
Woland1(at)poczta.onet.pl
Woland Guest
-
Natty Gur #4
Re: Access to Application object from exe
1)You need to reference mscoree tlb.
2)the code :
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Reflection;
using System.Runtime.InteropServices;
namespace WebApplication3
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button btnStop;
protected System.Web.UI.WebControls.CheckBoxList CheckBoxList1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (!this.IsPostBack)
GetAllDomains();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.CheckBoxList1.SelectedIndexChanged += new
System.EventHandler(this.CheckBoxList1_SelectedInd exChanged);
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnStop_Click(object sender, System.EventArgs e)
{
System.AppDomain.Unload (System.AppDomain.CurrentDomain );
mscoree.CorRuntimeHostClass host = new mscoree.CorRuntimeHostClass();
IntPtr enumHandle = IntPtr.Zero;
host.EnumDomains( out enumHandle );
object dom = null;
while(true)
{
host.NextDomain( enumHandle, out dom );
if( dom == null )
break;
AppDomain ad = (AppDomain) dom;
//dom = null;
for(int iIndx =0;iIndx < CheckBoxList1.Items.Count;iIndx++)
{
if ( CheckBoxList1.Items[iIndx].Value == ad.FriendlyName )
{
if ( CheckBoxList1.Items[iIndx].Selected == true )
{
System.Security.Policy.Evidence NE = new
System.Security.Policy.Evidence(ad.Evidence);
System.AppDomainSetup NADS = new System.AppDomainSetup();
NADS.ApplicationBase = ad.SetupInformation.ApplicationBase;
NADS.ApplicationName = ad.SetupInformation.ApplicationName;
NADS.ConfigurationFile = ad.SetupInformation.ConfigurationFile;
NADS.DynamicBase = ad.SetupInformation.DynamicBase;
NADS.PrivateBinPath = ad.SetupInformation.PrivateBinPath;
ad.ClearPrivatePath();
ad.ClearShadowCopyPath();
host.UnloadDomain( ad);
//host.DeleteLogicalThreadState ();
System.AppDomain.Unload (System.AppDomain.CurrentDomain );
//System.AppDomain.Unload(ad);
System.Web.Hosting.ApplicationHost.CreateApplicati onHost(System.T
ype.GetType("mscoree.CorRuntimeHostClass"),"CRExam ple","c:\\Inetpub\\www
root\\CRExample");
//System.AppDomain.CreateDomain(CheckBoxList1.Items[iIndx].Value
,NE,NADS ) ;
}
break;
}
}
dom = null;
ad = null;
}
host.CloseEnum( enumHandle );
int refctr = Marshal.ReleaseComObject( host );
host = null;
GetAllDomains();
}
private void GetAllDomains()
{
this.CheckBoxList1.Items.Clear ();
mscoree.CorRuntimeHostClass host = new mscoree.CorRuntimeHostClass();
IntPtr enumHandle = IntPtr.Zero;
host.EnumDomains( out enumHandle );
object dom = null;
while(true)
{
host.NextDomain( enumHandle, out dom );
if( dom == null )
break;
AppDomain ad = (AppDomain) dom;
dom = null;
ListItem oLI = new ListItem(ad.FriendlyName,ad.FriendlyName);
CheckBoxList1.Items.Add ( oLI);
//Response.Write ( ad.FriendlyName + "<br>");
//try
//{
// Assembly[] allAsm = ad.GetAssemblies();
//
// foreach( Assembly asm in allAsm )
// Response.Write( " -->" + asm.FullName + "<br>" );
//}
//catch (Exception err)
//{
// Response.Write(err.Message + "<br>" );
//}
//
ad = null;
}
host.CloseEnum( enumHandle );
int refctr = Marshal.ReleaseComObject( host );
host = null;
}
private void CheckBoxList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
}
}
}
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Woland #5
Re: Access to Application object from exe
"Natty Gur" <natty@dao2com.com> wrote in message
news:uTPrktEQDHA.2424@tk2msftngp13.phx.gbl...[...]> 1)You need to reference mscoree tlb.
> 2)the code :
Thanks very much Natty.> Natty Gur, CTO
Woland
Woland Guest



Reply With Quote

