473,503 Members | 1,643 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Web.HttpRuntime.AppDomainAppPath unavailable at DesignTime?

Hello:
Is there a way to get the path of the current website I am working on during designTime (when
current Context == null)?
System.Web.HttpRuntime.AppDomainAppPath is not available during designtime.
Thank you!

Sky
Nov 16 '05 #1
1 5488
Forget it: just came across the following code posted at:
http://www.123aspx.com/redir.aspx?res=31591
using EnvDTE;
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Collections;

namespace VSNET_DesignTimeHelperClass
{

public class TGetApplicationPath {
public string GetPath(){
ControlDesignerHelper cdh = new ControlDesignerHelper();
return(cdh.ProjectProperties("FullPath"));
}
}
public class ControlDesignerHelper
{
private DTE _oDTE = null;
private Hashtable ProjectPropertiesHashTable = new Hashtable();
private ArrayList ProjectPropertiesArrayList = new ArrayList();
public string AllProjectProperties="";

[DllImportAttribute("ole32.dll")]
private static extern int GetRunningObjectTable(int reserved, out UCOMIRunningObjectTable prot);

[DllImportAttribute("ole32.dll")]
private static extern int CreateBindCtx(int reserved, out UCOMIBindCtx ppbc);

//********************
// CONSTRUCTORS
//
/// <summary>
/// Default constructor needed for XML serialization
/// </summary>
public ControlDesignerHelper()
{
init();
}

~ControlDesignerHelper()
{
try { _oDTE = null; }
finally
{ //base.Finalize();
}
}

public string ProjectProperties( string key)
{
if ( ProjectPropertiesHashTable.ContainsKey(key))
return ProjectPropertiesHashTable[key].ToString();
else
return "";
}

private void GetMSDEVFromGIT(string left, string right)
{
int i;
UCOMIRunningObjectTable uCOMIRunningObjectTable;
UCOMIEnumMoniker uCOMIEnumMoniker;
UCOMIBindCtx uCOMIBindCtx;
string str;
object local;

try
{
GetRunningObjectTable(0, out uCOMIRunningObjectTable);
uCOMIRunningObjectTable.EnumRunning(out uCOMIEnumMoniker);
uCOMIEnumMoniker.Reset();
UCOMIMoniker[] uCOMIMonikers = new UCOMIMoniker[1];
while (uCOMIEnumMoniker.Next(1, uCOMIMonikers, out i) == 0)
{
CreateBindCtx(0, out uCOMIBindCtx);
uCOMIMonikers[0].GetDisplayName(uCOMIBindCtx, null, out str);
if (str.StartsWith(left) && str.EndsWith(right))
{
uCOMIRunningObjectTable.GetObject(uCOMIMonikers[0], out local);
_oDTE = (DTE)local;
}
}
}
catch ( Exception e)
{throw e;}
}

public void init()
{
System.Array projs;
EnvDTE.Project proj;
string propValue = "";
ProjectPropertiesHashTable.Clear();

GetMSDEVFromGIT("!VisualStudio.DTE.7",
System.Diagnostics.Process.GetCurrentProcess().Id. ToString());
if (_oDTE != null)
{
projs = (System.Array)_oDTE.ActiveSolutionProjects;
proj = (EnvDTE.Project)projs.GetValue(0);
EnvDTE.Properties pProps = proj.Properties;

for ( int i=1; i <= pProps.Count; i++)
{
propValue = "";
if ( pProps.Item(i).Value != null)
propValue = pProps.Item(i).Value.ToString();

try { ProjectPropertiesHashTable.Add( pProps.Item( i).Name, propValue); }
catch {}
}
// sort the items into a nice easy to read list. This hashtable index starts at one. Arrays
are zero
ProjectPropertiesArrayList = new ArrayList( ProjectPropertiesHashTable.Keys);
ProjectPropertiesArrayList.Sort();
AllProjectProperties = "<BR>ControlDesignerHelper Project Properties";
for ( int k=0; k < ProjectPropertiesArrayList.Count; k++)
AllProjectProperties += "<BR>&nbsp;&nbsp;" + (k+1).ToString() + " <B>" +
ProjectPropertiesArrayList[k].ToString() + "</B> - " +
ProjectPropertiesHashTable[ProjectPropertiesArrayList[k].ToString()].ToString();
}
}
}
}

"Sky Sigal" <as*******@xact-solutions.removethis.com> wrote in message
news:uv*************@TK2MSFTNGP12.phx.gbl...
Hello:
Is there a way to get the path of the current website I am working on during designTime (when
current Context == null)?
System.Web.HttpRuntime.AppDomainAppPath is not available during designtime.
Thank you!

Sky

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2051
by: Motherchucker | last post by:
I'm running FreeBSD and trying to install mod_php4-4.3.3 from an updated ports tree. When it tries to fetch libtool-1.4.3.tar.gz, I get the following output and it eventually fails. I ended up...
0
1781
by: Rahail | last post by:
Hello, I have a question, can someone help me please? What are the differences between a runtime and a designtime component? Is runtime component only good for running with the .exe and not...
0
2362
by: Ross Dempster | last post by:
Hi everyone, this is quite involved but if anyone can help (or just likes a challenge!) i would very much appreciate it. Quick intro : I have forms based authentication (though i do it manually...
0
1764
by: masago | last post by:
Hi....how are you ?? they can help me to solve this problem ?? Access to the path = "c:\windows\microsoft.net\framework\v1.1.4322\Temporary ASP.NET = Files\reports\06639073\bbab30a7" is...
7
2197
by: Varangian | last post by:
Hello is creating controls at runtime the same as designtime ? will a page be faster if controls are created at designtime rather than at runtime ? If so why ? thanks :)
1
3211
by: Jose Fernandez | last post by:
Hello First of all, sorry for my bad english ;) I have a USER class that i create to every user that enters the website (not neccesarily logged in). At the same time i insert it into a the...
4
22672
by: arun.hallan | last post by:
I know this has been asked umpteen times but i cant find an answer to my problem. Very simply, i have a GUI which is trying to call a webservice. The webservice may take any time from 5mins to...
7
11073
by: Mark Rae | last post by:
Hi, Has anyone successfully used the FTP stuff in the System.Net namespace against a VMS FTP server? I'm trying to do this at the moment and can't even get a directory listing, although there...
6
5155
by: =?Utf-8?B?emlubw==?= | last post by:
in asp.net 2, I load a dataset from the Cache object into a local object to use to perform processing. I had been using httpcontext.current.cache and what I noticed is sometime I'm not able to get...
0
7084
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7458
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.