Hi all,
Thanks to DeveloperX in my previous thread, I have made a little more
progress in my quest to get what I want...
Here is what I want to achieve...
InheritContext myContext = InheritContext.Current;
string path = myContext.Folder.Parent.Parent.Parent.Parent.Path; // Ignore
the "Path" part for the time being, it is the recursive parent that I am
interested in...
I have the myContext declaration set up, running and working. I can get
string path = myContext.Folder; but cannot get the .Parent.Parent..... etc.
running. Any help will be appreciated. I am sure it would be very simple but
I cannot work out how to make it work.
Here is my code... I have used a lot of "return null" as this is just a test
of the theory side. When I have it working initially, I will then fill the
returns to get proper values out.
namespace InheritTest
{
public class InheritContext : IDisposable
{
public InheritContext()
{
// Constructor
}
public void Dispose()
{
}
public Folders Folder()
{
return null;
}
}
public class Folders
{
public Folders Parent
{
get { return null; }
}
}
public class InheritHttpContext : InheritContext
{
public static InheritHttpContext Current
{
get
{
HttpContext cntx = HttpContext.Current;
return (InheritHttpContext)cntx.Items["InheritContext"];
// Can someone explain to me what the cntx.Items does and
where I should use it?
// I couldn't get this part to work without it, but now I
have it, what do I do with it?
}
}
}
}
If I have written the code above incorrectly (against best practice, that
sort of thing), I would appreciate any advice.
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available