[EDITED]NEP User Homepage

LnZLnZ Member Posts: 37
edited 2006-09-07 in Navision e-Commerce
Maybe it is not a NEP related question but I need to have differente homepages for different user/groups so when a user logon can see its own webpart page.
Is there a way to do this?
Thank You
As promised here is my simple code:
Imports System
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Xml.Serialization
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Utilities
Imports Microsoft.SharePoint.WebPartPages

'WebPart To Automatically Redirect User To Their Personal Pages
<DefaultProperty("Text"), ToolboxData("<{0}:UserRedirect runat=server></{0}:UserRedirect>"), XmlRoot(Namespace:="UserRedirect")> _
Public Class UserRedirect
    Inherits Microsoft.SharePoint.WebPartPages.WebPart

    Private Const _defaultText As String = ""

    Dim _text As String = _defaultText

    <Browsable(True), Category("Miscellaneous"), DefaultValue(_defaultText), WebPartStorage(Storage.Personal), FriendlyName("Text"), Description("Text Property")> _
    Property [Text]() As String
        Get
            Return _text
        End Get

        Set(ByVal Value As String)
            _text = Value
        End Set
    End Property

    'Render this Web Part to the output parameter specified.
    Protected Overrides Sub RenderWebPart(ByVal output As System.Web.UI.HtmlTextWriter)
        GetContent()
    End Sub

    Function GetContent()

        Dim UserName

        On Error Resume Next

        UserName = Page.Request.ServerVariables("Logon_User")
        If Len(UserName) = 0 Then
            UserName = "Anonymous"
        End If

        UserName = Split(UserName, "\")

        'Do not redirect if the domain administrator is accessing the page for admin purposes
        If RTrim(UCase(UserName(1))) <> RTrim("ADMINISTRATOR") Then
            'Redirect the user to their personal page.
            Page.Response.Redirect("http://localhost/Shared%20Documents/" & UserName & ".aspx")
        End If

    End Function
End Class
As you can see the code is very simple it just check the user name and redirect it to a page with the same name.
You should put this webpart on the homepage.
Hope it helps you
LnZ

Answers

  • LnZLnZ Member Posts: 37
    I Have used I simple .NET WebPart that automatically redirect a user to a predefined homepage.
    LnZ
  • MatthiasNMatthiasN Member Posts: 31
    Hi Lnz,

    can you post a link for this webpart - trying to solve the same problem.

    Cheers from Downunder.

    Matthias.
  • XaserXaser Member Posts: 7
    Yes plz, i am interested too.
    I want that a user do logon and directly enter to his site and not to the main site.

    Thx
  • MadhanMadhan Member Posts: 96
    Me too =D>
  • MatthiasNMatthiasN Member Posts: 31
    Since LnZ is not around it seems, anyone else please help.

    Thanks in anticipation!
  • LnZLnZ Member Posts: 37
    Hi all,
    sorry but I have been very busy lately.
    In the next days will post a reply with the webpart code
    LnZ
  • MatthiasNMatthiasN Member Posts: 31
    Cool - thanks LnZ!

    I thought this one was blackholed .............
Sign In or Register to comment.