Load an ASP.NET 2.0 aspx page using System.Reflection?
Can I load an stand alone aspx page in another stand alone aspx page using System.Reflection? I am using the ASP.NET 2.0 Web site project model. ...
Can I load an stand alone aspx page in another stand alone aspx page using System.Reflection? I am using the ASP.NET 2.0 Web site project model. ...
I have a problem with reflection. I need to find the type that instantiates a static member. My code looks like this: private class SimpleTemplate : PageTemplate { internal static readonly IPageProperty NameProperty = PropertyRepository.Register("Name"); } The PropertyRepository is a repository of prope...
I am trying to workout a way to programatically create a key for Memcached, based on the Method Name and parameters. So if I have a method: string GetName(int param1, int param2); It would return: string key = "GetName(1,2)"; I know you can get the MethodBase using reflection, but I need the parameters values in the string not the...
What is the best way to convert a string into a Type object in .NET? Issues to consider: The type may be in a different assembly. The type's assembly may not be loaded yet. This is my attempt, but it doesn't address the second issue Public Function FindType(ByVal name As String) As Type Dim base As Type base = Reflection.A...
Can you call a vb.net api function using reflection from javascript code? I just started playing around with reflection, I have this snippet of code that works, I want to change it to a javascript page. Dim RawPlugin As Reflection.Assembly RawPlugin = Reflection.Assembly.LoadFrom("C:\Inetpub\wwwroot\demo\MasterApplication\getSession\bi...
I am populating different types objects with datarows with each attrivute of the relevant object = to the similiarly name field in the datarow. I'd like to use a generic function to do this. How do I force the Type of the return object from the generic function. I don't yet know what the <T> syntax actually means: PopulateObject<T> doe...
I have made a custom Attribute here named AAtribute, and for instance a class called B where one or more methods use the attribute. Is it possible to get the MethodInfo of the method that holds the attribute (in this case BMethod1) as (one of) it's attributes without walking through the whole assembly and looking at all defined methods f...
The constructor looks like this: public NameAndValue(string name, string value) I need to get it as a MethodInfo using Reflection. It tried the following, but it does not find the constructor (GetMethod returns null). MethodInfo constructor = typeof(NameAndValue).GetMethod(".ctor", new[] { typeof(string), typeof(string) }); What a...
I was looking at the msdn documentation and I am still a little confused on what exactly is the difference between using LoadFile and LoadFrom when loading an assembly. Can someone provide an example or an analogy to better describe it. The MSDN documentation confused me more. Also, Is ReflectionOnlyLoadFrom the same as LoadFrom except t...
Since this stuff is fair new I couldn't figure out any good reference on it. I want to use reflection to enumerate through all the controller in my application. This is not hard using reflection. But since area come into place. How do I know which area (if any) does a particular controller belong to? Maybe I am doing it wrong, maybe I ...
Is there anyway to set a value of a static (private) variable without needing to initalize the object? The SetValue method requires an instance, but I'm hoping there's a way to get around this. Thanks! ...
In both my NUnit SetUp and TearDown methods, I need to retrieve the MethodInfo of the test that is about to be run or has been run. Is this possible? I'm using NUnit 2.5. Motivation: I would like to be able to retrieve, via Reflection, attributes attached to the test method. ...
Hi, I am using a xml file as an embedded resource to load an XDocument. We are using the following code to get the appropriate file from the Assembly: XDocument xd = new XDocument(); Assembly assembly = null; try { assembly = Assembly.GetExecutingAssembly(); } catch(Exception ex) { //Write exception to server event log } try {...
I am trying to determine every single reference inside a dll with System.Reflection. However, GetReferencedAssemblies only lists the ones in the "References" (visible in solution explorer). I would like to determine references from within the code itself, such as an imports statement. Even things like if/then statements, try/catch, abs...
Hello, Let's say I've a class myClass which has few properties, such as property1, property2, perperty3, etc. Now, I'd like to populate an array with each of those properties so that, I can access each of them through its index. Is there an automatic way of doing so? Here's an example from SportsStore (Pro ASPN.NET MVC/Steve Sanderson...
Before start let me tell my experience: I am experienced with C#.NET, web services, XML part and few more. Reflection is something new to me, though I have read extensively on it and tried out some experimental code, but haven't made anything great using reflection I checked out many examples of how we can create Type at runtime and the...
sTypeName = ... //do some string stuff here to get the name of the type /* The Assembly.CreateInstance function returns a type of System.object. I want to type cast it to the type whose name is sTypeName. assembly.CreateInstance(sTypeName) So, in effect I want to do something like: */ assembly.CreateInstance(sTypeName) as Type.GetT...
I am using Assembly.LoadFrom within a web service to load assemblies from a web site. but the problem is it is in the virutal directory and the server.mappath parses the url like \share\mydll.dll and loadform method failed. Is there anyway to reference dll from the remote location? I've tried passing the url (http://localhost/download...
Hello all, I have written an application that unit tests our hardware via a internet browser. I have command classes in the assembly that are a wrapper around individual web browser actions such as ticking a checkbox, selecting from a dropdown box as such: BasicConfigurationCommands EventConfigurationCommands StabilizationCommands a...
Possible Duplicate: Reflection. What can we achieve using it? I see plenty of examples of using reflection in c#, but I'm not sure exactly what all it is mainly used for in c#. So when do you use it? ...