YAFLogo

yeutuihok
  • yeutuihok
  • 51.2% (Neutral)
  • YAF Forumling Topic Starter
6 years ago
:?:

i use YAF in local

i'm going to create a page for manager some function.

i created adsmanager.aspx in root directory and add link in YafHeader.ascx:


 <asp:PlaceHolder ID="AdminModHolder" runat="server" Visible="false">
              <ul class="menuAdminList">
                 <li class="menuAdmin"><a title="Go to Ads Manager" href="http://localhost:20937/adsmanager.aspx" target="_top">Ads Manager</a></li>
                <asp:PlaceHolder ID="menuAdminItems" runat="server"></asp:PlaceHolder>
              </ul>
            </asp:PlaceHolder>

i access defaut.aspx and login with admin account. the link above is appear but when i click it, it always go to http://localhost:20937/adsmanager.aspx with defaut interface of forum.ascx

i view this post: http://forum.yetanotherforum.net/forum/posts/t14033-Create-a-custom-page 

but still can't understand what need to do.

some one can help me clearly step by step?

thank, by the way help me to detect user loged in/or not in new page adsmanager.aspx

Sponsor
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
6 years ago
exclude the page from the urlrewriter. all you need is open the file urlrewriter.config

and change line...

<if url="^((?!\.ashx|\.asmx|\.axd|\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js|\/install|error\.aspx|auth\.aspx|default\.aspx|popup\.aspx|advanced\.aspx|digest\.aspx|ftb.imagegallery\.aspx|ckfinder).)*$">
    <rewrite url="^~/(.+)?\?(.+)?$" to="~/Default.aspx?g=$1&amp;$2" processing="stop" />
    <rewrite url="^~/(.+)?\.aspx$" to="~/Default.aspx?g=$1" processing="stop" /> 
    <rewrite url="^~/(.+)?$" to="~/Default.aspx?g=$1" processing="stop" />
  </if>

to....

<if url="^((?!\.ashx|\.asmx|\.axd|\.gif|\.png|\.jpg|\.ico|\.pdf|\.css|\.js|\/install|error\.aspx|auth\.aspx|default\.aspx|popup\.aspx|advanced\.aspx|digest\.aspx|ftb.imagegallery\.aspx|ckfinder|adsmanager\.aspx).)*$">
    <rewrite url="^~/(.+)?\?(.+)?$" to="~/Default.aspx?g=$1&amp;$2" processing="stop" />
    <rewrite url="^~/(.+)?\.aspx$" to="~/Default.aspx?g=$1" processing="stop" /> 
    <rewrite url="^~/(.+)?$" to="~/Default.aspx?g=$1" processing="stop" />
  </if>
tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.0 rc 2
6 years ago

by the way help me to detect user loged in/or not in new page adsmanager.aspx

Originally Posted by: yeutuihok 

if (HttpContext.Current.User.Identity.IsAuthenticated)
                    {
                       // do action if user is logged in
                    }
else  {

// do other action if user is aguest
}

yeutuihok
  • yeutuihok
  • 51.2% (Neutral)
  • YAF Forumling Topic Starter
6 years ago
THANKS tha_watcha SO MUCH! I CLICKED THANK BUTTON FOR YOU ❤