Sir,
I have try that but didn't find problem i am posting code for auto login so you can tell where the error is.
ViewLogin.ascx.vb
--------
Imports DotNetNuke
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.Reflection
Namespace Modules.Login
''' -----------------------------------------------------------------------------
''' <summary>
''' The ViewDynamicModule class displays the content
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' </history>
''' -----------------------------------------------------------------------------
Partial Class ViewLogin
Inherits Entities.Modules.PortalModuleBase
Implements Entities.Modules.IActionable
#Region "Private Members"
Private strTemplate As String
#End Region
Dim Username As String
Dim ItemId As String
#Region "Event Handlers"
''' -----------------------------------------------------------------------------
''' <summary>
''' Page_Load runs when the control is loaded
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' </history>
''' -----------------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load
Try
If Not Page.IsPostBack Then
If CType(Settings("template"), String) <> "" Then
strTemplate = CType(Settings("template"), String)
Else
strTemplate = Localization.GetString("Template.Text", LocalResourceFile)
End If
Dim objLogins As New LoginController
Dim colLogins As List(Of LoginInfo)
'Dim colLogin As String
' get the content from the Login table
colLogins = objLogins.GetLogins(ModuleId)
If colLogins.Count = 0 Then
If Localization.GetString("DefaultContent", LocalResourceFile) <> "" Then
' add the content to the Login table
Dim objLogin As LoginInfo = New LoginInfo
objLogin.ModuleId = ModuleId
'objLogin.ItemId = ItemId
objLogin.Username = "Host"
objLogin.Password = "sandeep"
objLogin.ParentUserID = 12
objLogin.Notes = "welcome"
objLogin.LastLogin = System.DateTime.Now
objLogin.AutoLogInAccountUserID = Me.UserId
objLogins.AddAutoLogin(objLogin)
End If
End If
'bind the content to the repeater
lstContent.DataSource = colLogins
lstContent.DataBind()
Repeater1.DataSource = colLogins
Repeater1.DataBind()
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
Protected Sub lstContent_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles lstContent.ItemDataBound
Dim strContent As String = strTemplate
Dim strValue As String
' add content to template
Dim objProperties As ArrayList = Common.Utilities.CBO.GetPropertyInfo(GetType(LoginInfo))
Dim intProperty As Integer
Dim objPropertyInfo As PropertyInfo
For intProperty = 0 To objProperties.Count - 1
objPropertyInfo = CType(objProperties(intProperty), PropertyInfo)
If strContent.IndexOf("[" & objPropertyInfo.Name.ToUpper & "]") <> -1 Then
strValue = Server.HtmlDecode(DataBinder.Eval(e.Item.DataItem, objPropertyInfo.Name).ToString())
strContent = strContent.Replace("[" & objPropertyInfo.Name.ToUpper & "]", strValue)
End If
Next intProperty
' assign the content
Dim lblContent As Label = CType(e.Item.FindControl("lblContent"), Label)
lblContent.Text = strContent
End Sub
#End Region
#Region "Optional Interfaces"
''' -----------------------------------------------------------------------------
''' <summary>
''' Registers the module actions required for interfacing with the portal framework
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
''' <history>
''' </history>
''' -----------------------------------------------------------------------------
Public ReadOnly Property ModuleActions() As Entities.Modules.Actions.ModuleActionCollection Implements Entities.Modules.IActionable.ModuleActions
Get
Dim Actions As New Entities.Modules.Actions.ModuleActionCollection
Actions.Add(GetNextActionID, Localization.GetString(Entities.Modules.Actions.ModuleActionType.AddContent, LocalResourceFile), Entities.Modules.Actions.ModuleActionType.AddContent, "", "", EditUrl(), False, Security.SecurityAccessLevel.Edit, True, False)
Return Actions
End Get
End Property
#End Region
End Class
End Namespace
Code For EditLogin.ascx.vb
-----------(Page load code)-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load
If Not Page.IsPostBack Then
If Not Request.UserHostAddress Is Nothing Then
StrString = Request.UserHostAddress
End If
Dim objLogins As New LoginController
ArrArray = StrString.Split(".")
IP1 = ArrArray(0).ToString
IP2 = ArrArray(1).ToString
IP3 = ArrArray(2).ToString
IP4 = ArrArray(3).ToString
Dim objIpRange As LoginInfo = objLogins.GetIpRange(IP1, IP2, IP3, IP4)
If objLogins.GetIpRange(IP1, IP2, IP3, IP4) Is Nothing Then
' Response.Redirect(NavigateURL(), True)
Response.Redirect("~/Default.aspx")
End If
Dim objLogin As LoginInfo = objLogins.GetLogin1(ModuleId)
txtUsername.Text = objLogin.Username
txtPassword.Text = objLogin.Password
txtMessage.Text = objLogin.WelcomeMessageBody
'Dim userName As String = txtUsername.Text
'Dim password As String = txtPassword.Text
'--------------------page load auto login facality------------------------
'-------------------page load ends here-------------------------------
If Not Null.IsNull(PortalSettings.LoginTabId) And IsAdminControl() Then
' login page exists and trying to access this control directly with url param -> not allowed
Response.Redirect(NavigateURL(PortalSettings.LoginTabId))
End If
If Not Request.IsAuthenticated Then
If Page.IsPostBack = False Then
Try
If Not Request.QueryString("verificationcode") Is Nothing Then
If PortalSettings.UserRegistration = PortalRegistrationType.VerifiedRegistration Then
'Display Verification Rows
rowVerification1.Visible = True
rowVerification2.Visible = True
txtVerification.Text = Request.QueryString("verificationcode")
End If
End If
'PageNo = 0
If Not Request.QueryString("username") Is Nothing Then
txtUsername.Text = Request.QueryString("username")
End If
Catch
'control not there
End Try
End If
'ShowPanel()
Else ' user is already authenticated
' if a Login Page has not been specified for the portal
If IsAdminControl() Then
' redirect to current page
Response.Redirect(NavigateURL(), True)
Else ' make module container invisible if user is not a page admin
If Not DotNetNuke.Security.Permissions.TabPermissionController.HasTabPermission("EDIT") Then
ContainerControl.Visible = False
End If
End If
End If
End If
Try
'Label1.Text = Request.UserHostAddress
' Determine ItemId of Login to Update
If Not (Request.QueryString("ItemId") Is Nothing) Then
ItemId = Int32.Parse(Request.QueryString("ItemId"))
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
please help me in this code if is there anything wrong.
Thanking You,
sandeep jain