Click here to Skip to main content
15,891,855 members
Articles / Web Development / HTML

DotNetNuke Silverlight 3.0 Hello World

Rate me:
Please Sign up or sign in to vote.
4.93/5 (6 votes)
3 Aug 2009Ms-PL3 min read 49.2K   242   28  
The goal of this tutorial is to walk you through creating a simple Silverlight module in DotNetNuke that authenticates the currently logged in user through a web service.
<%@ WebService Language="C#" Class="HelloWorld3.WebService" %>

using System.Web.Services;
using DotNetNuke.Entities.Users;

namespace HelloWorld3
{
    [WebService(Namespace = "http://ADefWebserver.com/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class WebService : System.Web.Services.WebService
    {
        #region GetUsername()
        [WebMethod]
        public string GetUsername()
        {
            string strUsername = "World!";

            // Get the current user 
            UserInfo objUserInfo = UserController.GetCurrentUserInfo();

            // If the user is not -1 they are logged in
            if (objUserInfo.UserID > -1)
            {
                strUsername = objUserInfo.DisplayName;
            }

            return strUsername;
        }
        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer (Senior) http://ADefWebserver.com
United States United States
Michael Washington is a Microsoft MVP. He is a ASP.NET and
C# programmer.
He is the founder of
AiHelpWebsite.com,
LightSwitchHelpWebsite.com, and
HoloLensHelpWebsite.com.

He has a son, Zachary and resides in Los Angeles with his wife Valerie.

He is the Author of:

Comments and Discussions