xuanvu
  •  xuanvu
  • 78.8% (Friendly)
  • YAF Forumling Topic Starter
2009-03-17T10:33:30Z
Hi all,
I want to use some of YAF user controls (such as controls>ProfileYourAccount.ascx, etc...), but in order to load the user' information, it needs "PageContext.PageUserID", where can I get this value?

Thanks,
Kenny.
Sponsor
Nightvision
2009-06-15T20:35:27Z
I ran across this post while trying to figure out the same issue, and while I suspect it's too late to help this poster, perhaps somebody else will need this information at some point in the future. Perhaps I can save somebody else the time I spend digging through the source (although there is value in doing so).

I solved the problem by putting the following in my master page:

<YAF:Forum runat="server" ID="forum" Visible="false"></YAF:Forum>

If you don't have a master page you will need to put that line into each .aspx file that needs to use YAF controls.

My divination of the code lead me to the conclusion that the PageContext is built dynamically, and to try to recreate all or part of this functionality outside the YAF:Forum object would be onerous. My assumption is that the author specifically included the Visible property in the YAF:Forum tag for this very reason.

However, I don't pretend to know whether there are any downsides or risks to using the control in this manner.
pbwbart
2009-06-15T21:12:08Z
I have a simular problem.
The only difference is that I don't use a webapplication where I need the PageContext.
Do you know how I can set the pagecontext using a desktop application or in my case using a service?

If I have to use parameters or Id's which are stored in the database for a user that is no problem. I can copy them directly into my source if I have to to simulate some kind of session.

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved