refrence not set to an instance of an object

UmerMahir

New member
Joined
Aug 5, 2022
Messages
3
Programming Experience
1-3
im verymuch new to vb.net i have developed webforms using asp.net and vb.net everything works fine when i run it in visual studio 2019
but when i published it to Plesk i got this error please help


Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.


Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:



[NullReferenceException: Object reference not set to an instance of an object.]
DotNetNuke.Common.Globals.get_Status() +72
DotNetNuke.Common.Initialize.CheckVersion(HttpApplication app) +160
DotNetNuke.Common.Initialize.InitializeApp(HttpApplication app, Boolean& initialized) +130
DotNetNuke.Common.Initialize.Init(HttpApplication app) +160
DotNetNuke.Web.Common.Internal.DotNetNukeHttpApplication.Application_BeginRequest(Object sender, EventArgs e) +472
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +144
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +50
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +73

 
please help me and tell me whats wrong heres vb.net code for login page

VB.NET:
Imports MySql.Data.MySqlClient
Public Class StudentLogIn
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim conn As New MyConnection()
        Dim adapter As New MySqlDataAdapter()
        Dim User As New DataTable()
        Dim command As New MySqlCommand("SELECT UserName,Password FROM User WHERE UserName=@UName AND Password=@Pass", conn.getConnection())

        command.Parameters.Add("@UName", MySqlDbType.VarChar).Value = txtUserName
        command.Parameters.Add("@Pass", MySqlDbType.VarChar).Value = txtPassword


        If txtUserName.Text = "UName" And txtPassword.Text = "" Then
            MsgBox("Enter Password")

        ElseIf txtUserName.Text = "" Or txtPassword.Text = "Pass" Then
            MsgBox("Invalid Username")

        ElseIf txtUserName.Text = "" Or txtPassword.Text = "" Then
            MsgBox("Invalid UserName or Password")

        Else

            adapter.SelectCommand = command
            adapter.Fill(User)

            If User.Rows.Count > +0 Then
                MsgBox("LoggedIN")


            Else
                MsgBox("Failed")

                conn.closeConnection()


            End If
        End If


    End Sub

    Protected Sub LinkButton1_Click(sender As Object, e As EventArgs) Handles LinkButton1.Click

        Response.Redirect("StudentSignUp.aspx")

    End Sub
End Class
 
Last edited by a moderator:
It appears to be related to DotNetNuke, based on the stack trace. I've never used that myself but you might confirm that you have deployed all required dependencies and configuration. Are you supposed to be specifying a version that you're not?
 
It appears to be related to DotNetNuke, based on the stack trace. I've never used that myself but you might confirm that you have deployed all required dependencies and configuration. Are you supposed to be specifying a version that you're not?
i have absolutely no idea its just been a month ive started vb.net and asp.net so my experience 1month minus the weekends ive been trying from last 4 days to find out where im going wrong. the above is the codebehind for asp.net form even when i run it in visual studio its working like a charm soonas its published it doesent work on iis locally in windows and on plesk the above error i will be greatful if i can get help this error is making me crazy, since it doesnt show any error in vs when i run so i have no clue, could there be a problem with my connection because i have made a module which im calling ?? here is the code

VB.NET:
Imports MySql.Data.MySqlClient

module mymodule


Public Class MyConnection

Private connection As New MySqlConnection("datasource=208.109.23.31;port=3306;username=zng6y234hzme;password=Hamsen12#;database=1journey;")

ReadOnly Property getConnection() As MySqlConnection
Get
Return connection
End Get
End Property

'opening the connection
Sub openConnection()

If connection.State = ConnectionState.Closed Then
connection.Open()
End If
End Sub

'closing connection

Sub closeConnection()

If connection.State = ConnectionState.Open Then
connection.Close()
End If

End Sub


End Class

end module
 
Last edited:
Back
Top