YAFLogo

Zero2Cool
  • Zero2Cool
  • 100% (Exalted)
  • YAF Leader Topic Starter
2012-06-29T23:32:11Z
I'm wanting to use the CSS, web.config and registration from YAF to build a site around it rather than use DotNetNuke since I only need the ability to make static HTML pages. The only thing any of the pages will need to do is pull the UserID from the yaf_User table.

I'm preferring this method because it should be easier to do upgrades with YAF and I'm hoping for a performance improvement too. DNN is somewhat of a resource hog, plus wastes space in the database.

I'm not sure what is the best method to approach this with.

Do I reference a DLL in a ASP.NET project?

Do I pull the source code and add my additional pages to the project? If I did this, wouldn't it be a pain to upgrade?

Any help would be appreciated. I just don't want to have to update two things all the time when all I really need is within YAF.

Sponsor
Jaben
  • Jaben
  • 100% (Exalted)
  • YAF Developer
2012-07-01T00:56:23Z
Hmm, not sure what parts of YAF you'd want to leverage for this sort of thing. The ASP.NET membership is just standard ASP.NET stuff. Otherwise, you can make a simple database-driven CMS.

Maybe you want the editor/logging system in YAF.NET?


UserPostedImage 
Zero2Cool
  • Zero2Cool
  • 100% (Exalted)
  • YAF Leader Topic Starter
2012-07-01T01:11:46Z
Originally Posted by: Jaben 

Hmm, not sure what parts of YAF you'd want to leverage for this sort of thing. The ASP.NET membership is just standard ASP.NET stuff. Otherwise, you can make a simple database-driven CMS.

Maybe you want the editor/logging system in YAF.NET?

I have ~4 pages that do not require the user to be logged in to view.

The GameDay Chat page requires the user to be logged in because their username is passed to the IRC chat that enters them into our chatroom with their YAF username.

I'd like to build a Web Application Project referencing whatever method (or provider) is needed to find out if the user is logged in and if so, return the username and UserID.

Sorry if I'm not making sense.

Edit, I'll be using YAF signup/register/login for the users just as if my site was nothing but YAF. But I need some pages in addition to YAF.

I want to use the YAF web.config for the connection string to display a page that shows who's Thanked the most and who's been Thanked the most and other little custom queries.

Zero2Cool
  • Zero2Cool
  • 100% (Exalted)
  • YAF Leader Topic Starter
2012-07-01T03:13:11Z
Okay, I think I may have found what I'm looking for.

Default.aspx

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Welcome to ASP.NET!
    </h2>
    <p>
        To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>.
    </p>
    <p>
        You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&amp;clcid=0x409"
            title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>.
    </p>
    <asp:Label runat="server" ID="myLabel" Text="This value should change"></asp:Label>

</asp:Content> 



Defaulst.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using YAF.Core;
using YAF.Types;

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (YAF.Core.YafContext.Current.PageUserID > 0)
            {
//user logged in 
                myLabel.Text = YAF.Core.YafContext.Current.PageUserID.ToString();
            }
            else
            {
//user not logged in
                myLabel.Text = YAF.Core.YafContext.Current.PageUserID.ToString();
            }        
        }

    }
}

I'm getting this error.

Quote:

Error 1 The type 'YAF.Types.Interfaces.IHaveServiceLocator' is defined in an assembly that is not referenced. You must add a reference to assembly 'YAF.Types, Version=1.9.6.0, Culture=neutral, PublicKeyToken=f3828393ba2d803c'. C:\Users\Kevin\Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#\Web\WebApplication1\Default.aspx.cs 24 13 WebApplication1

I'm still new to web applications, but I think I have to reference YAF.Types at the top of the aspx page, right?

Jaben
  • Jaben
  • 100% (Exalted)
  • YAF Developer
2012-07-01T03:28:05Z
You need to reference YAF.Types in your project.
UserPostedImage 
Zero2Cool
  • Zero2Cool
  • 100% (Exalted)
  • YAF Leader Topic Starter
2012-07-01T03:32:32Z
Originally Posted by: Jaben 

You need to reference YAF.Types in your project.

I have "YAF.Core" and "YAF.Types" displayed under my "References" folder and I have both of them referenced at the top of the code behind as ...

using YAF.Core;

using YAF.Types;

This is probably something really easy, but I'm embarrassingly stumped on what I'm missing.

Zero2Cool
  • Zero2Cool
  • 100% (Exalted)
  • YAF Leader Topic Starter
2012-07-01T03:53:18Z
Okay, I screwed up. I didn't pull the YAF.Core and YAF.Types DLL's from the same full site backup archive.
Zero2Cool
  • Zero2Cool
  • 100% (Exalted)
  • YAF Leader Topic Starter