.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rating: Thread Rating: 7 votes, 4.29 average. Display Modes
 
Unread ASP Free Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #16  
Old April 17th, 2007, 02:21 AM
hapidose hapidose is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 17 hapidose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 46 sec
Reputation Power: 0
hi sir. I've tried looking at this but I don't seem to see any of this as the reason why I got this message. I am using dotnetnuke, a good cms. I created a custom module from the super simple DAL+ tutorial (you can check it out) it works smoothly. I had placed a script block in the .aspx code of my module that works. I THEN COMMENTED OUT ALL OTHER CODE IN THE .ASPX and .ASPX.VB codes except imports, header and end of class declaration, and the control directive.

e.g.

in .aspx.vb code:

imports ...
imports...
imports...
imports...

Partial Class Something Inherits Something

End Class

in .aspx code:

<@control language="vb" ....................>

<script>

this is my working code that automatically logs in a user to dotnetnuke, from clicking a hyperlink from a main website.
</script>
------------------------------------------------------------so that's what's left. THEN, I get the error when I click the Logout button from the dotnetnuke website....

so sir, do you have any ideas? thanks for imparting your knowledge to a newbie. regards.

Reply With Quote
  #17  
Old April 17th, 2007, 02:35 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,608 Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 4 Days 12 h 53 m 47 sec
Reputation Power: 1400
hello and welcome to aspfree.

if you want help, you'll have to post full error message
and the relevant code.

we don't have telepathic tiaras over here.

Reply With Quote
  #18  
Old April 17th, 2007, 03:26 AM
hapidose hapidose is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 17 hapidose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 46 sec
Reputation Power: 0
Quote:
Originally Posted by Shadow Wizard
hello and welcome to aspfree.

if you want help, you'll have to post full error message
and the relevant code.

we don't have telepathic tiaras over here.


good day sir, thanks for the prompt response! the error is the same name as the thread sir.

"Object reference not set to an instance of an object error"

the code I have posted the skeleton of it previously. the .aspx.vb code and the .aspx code.

do you need the code itself? the explanation as well is in the previous post sir.

Reply With Quote
  #19  
Old April 17th, 2007, 03:32 AM
hapidose hapidose is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 17 hapidose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 46 sec
Reputation Power: 0
this is the original .aspx code:
Code:
<%@ Control Language="VB" 
AutoEventWireup="false"
CodeFile="SuperSimple.ascx.vb"
Inherits="DesktopModules_SuperSimple_SuperSimple" %>

Search:&nbsp;
<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>&nbsp;
<asp:Button ID="btnSearch" runat="server" Text="Button" /><br />
<br /> 
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>

this is the original .aspx.vb code:

Imports DotNetNuke
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.Reflection
Imports DotNetNuke.Security.PortalSecurity

Partial Class DesktopModules_SuperSimple_SuperSimple

Inherits Entities.Modules.PortalModuleBase

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

If Not Page.IsPostBack Then
  ShowData("")
End If

End Sub

Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click

ShowData(txtSearch.Text)

End Sub

Private Sub ShowData(ByVal SearchString As String)

Dim mySqlString As New StringBuilder()

mySqlString.Append("SELECT FriendlyName, Description ")
mySqlString.Append("FROM {databaseOwner}{objectQualifier}DesktopModules ")
mySqlString.Append("WHERE Description like '%' + @SearchString + '%' ")
mySqlString.Append("ORDER BY FriendlyName")

Dim myParam As SqlParameter = New SqlParameter("@SearchString", SqlDbType.VarChar, 150)

myParam.Value = SearchString

Me.GridView1.DataSource = CType(DataProvider.Instance().ExecuteSQL(mySqlStri  ng.ToString(), myParam), IDataReader)

Me.GridView1.DataBind()

End Sub

End Class



THEN THIS IS WHAT'S LEFT:

in the .aspx code:
Code:
<%@ Control Language="VB" 
AutoEventWireup="false"
CodeFile="SuperSimple.ascx.vb"
Inherits="DesktopModules_SuperSimple_SuperSimple" %>

in the .aspx.vb code: next reply....

Last edited by nofriends : April 17th, 2007 at 05:04 AM. Reason: added [code][/code] tags

Reply With Quote
  #20  
Old April 17th, 2007, 03:36 AM
hapidose hapidose is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 17 hapidose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 46 sec
Reputation Power: 0
Code:
Imports DotNetNuke
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.Reflection
Imports DotNetNuke.Security.PortalSecurity

Partial Class DesktopModules_SuperSimple_SuperSimple

Inherits Entities.Modules.PortalModuleBase

End class



so you see sir, I took out almost everything. then i entered code in the .aspx page:


<script>

code that logs in automatically a user that entered a main portal, and then clicked in my dotnetnuke portal.
</script>


It all works well. dotnetnuke recognizes the person. but when I try to logout, the error shows up. here is the generic code given to me. next reply

Last edited by nofriends : April 17th, 2007 at 05:05 AM. Reason: added [code][/code] tags

Reply With Quote
  #21  
Old April 17th, 2007, 03:39 AM
hapidose hapidose is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 17 hapidose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 46 sec
Reputation Power: 0
Code:
<script runat="server">
    Protected Sub Page_Load(ByVal O As Object, ByVal E As EventArgs)
        
        If Not (Page.IsPostBack) Then
            Dim UserName As String = Request.QueryString("empno")
            Response.Write("pasok 1")
            Dim intUser As Integer = Me.UserId
            If (intUser > 0) Then
    
            Else
               
                Dim objUser As UserInfo = UserController.GetUserByName(Me.PortalId, UserName)
   
                If Not (objUser Is Nothing) And objUser.Membership.Approved And Not (objUser.Membership.LockedOut = True) Then

                    UserAuthorized(objUser)
                End If
            End If
        End If
    End Sub
    
    Private Sub UserAuthorized(ByVal objectUser As UserInfo)

        Dim strMessage As String = String.Empty
        Dim updatePassword As Boolean = False
        Dim updateProfile As Boolean = False

        Dim UserId As String = objectUser.UserID
        If Not (objectUser.Profile Is Nothing) And Not (objectUser.Profile.PreferredLocale Is Nothing) Then

            Localization.SetLanguage(objectUser.Profile.Prefer  redLocale)
        
        Else

            Localization.SetLanguage(PortalSettings.DefaultLan  guage)
        End If

        UserController.UserLogin(PortalId, objectUser, PortalSettings.PortalName, <ip address>, False)
       
        Try

            Response.Redirect("Default.aspx")

        Catch ex As Exception

            'AddModuleMessage(ex.ToString(), DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleM  essageType.RedError, True)
            
            Response.Write(ex.StackTrace)
        End Try
    End Sub  
</script>

-----> I suspect, I dont have a logout mechanism in this module. can you help me? or could it be a different problem that's why the error shows up? thanks sir for the support.

Last edited by nofriends : April 17th, 2007 at 05:05 AM. Reason: added [code][/code] tags

Reply With Quote
  #22  
Old April 17th, 2007, 05:12 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,608 Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 4 Days 12 h 53 m 47 sec
Reputation Power: 1400
you do have code in there, so I need full error message that contains
among the rest line number. that line number tells the programmer
what code cause problems, then the programmer can fix it.

Reply With Quote
  #23  
Old April 18th, 2007, 10:14 PM
hapidose hapidose is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 17 hapidose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 46 sec
Reputation Power: 0
Quote:
Originally Posted by Shadow Wizard
you do have code in there, so I need full error message that contains
among the rest line number. that line number tells the programmer
what code cause problems, then the programmer can fix it.


ok sir. but my visual studio cant build the website with debugging, it causes an error so what I do is just alt+f5 and it runs. so I cant really see the error or the line number where there is an error. only that error I gave you, the one that shows up in the site....

Reply With Quote
  #24  
Old April 18th, 2007, 10:36 PM
hapidose hapidose is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 17 hapidose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 46 sec
Reputation Power: 0
Quote:
Originally Posted by Shadow Wizard
you do have code in there, so I need full error message that contains
among the rest line number. that line number tells the programmer
what code cause problems, then the programmer can fix it.



I tried to catch the exception nullreferenceexception:

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

it is found in my page load, more likely to be in because it always said that I have to catch the exception of the italicized part:

If Not (objUser Is Nothing) And objUser.Membership.Approved And Not (objUser.Membership.LockedOut = True) Then
UserAuthorized(objUser)
End If

Reply With Quote
  #25  
Old April 19th, 2007, 02:07 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,608 Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 4 Days 12 h 53 m 47 sec
Reputation Power: 1400
And is not like the "&&" operator - the phrase objUser.Membership.Approved
will be parsed even when the first phrase is True.
that's one of the reasons I prefer C language over Basic.

the only way that I'm aware of in VB is like this:
Code:
If Not (objUser Is Nothing) Then
   If objUser.Membership.Approved  And Not (objUser.Membership.LockedOut = True) Then
      UserAuthorized(objUser)
   End If
End If

FYI in C# it can be written in much less lines:
Code:
if (objUser != null && objUser.Membership.Approved && !objUser.Membership.LockedOut )
   UserAuthorized(objUser);

see why many programmers prefer this language?

Reply With Quote
  #26  
Old April 19th, 2007, 02:47 AM
hapidose hapidose is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 17 hapidose User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 8 m 46 sec
Reputation Power: 0
i don't get error anymore because I just catched the error and It seems that the user logs out just fine =P I will do what you suggested since I'm not doing anything else sir thanks!

by the way, I have a problem with using sessions since I'm very new in asp.net sir... could you please help me in the thread I created? How to use Sessions in asp.net

I am targeting to have the website be accessible to all users in the intranet, where in they can all log in at the same time. because, i've seen, that if my previous user is logged and another would log in, that one logs in as the previous user. but when the previous user is logged out, the other can log in perfect.(this is using the automatic log in code above)

about the C#, they say there are really tradeoffs. like in C#, it is not forgiving. you have to type in the correct variable or method or class with proper capitalization. it also uses braces that are not that friendly and C# is not that readable too. that's what they say. and in vb, you could design the forms and it generates the codes for you. so people here encouraged me to use it. =P though I program in java and before in college I used C. =P

Reply With Quote
  #27  
Old April 19th, 2007, 02:57 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,608 Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 6th Grade (Above 100000 Reputation Level)  Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325618 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 4 Days 12 h 53 m 47 sec
Reputation Power: 1400
Quote:
that if my previous user is logged and another would log in, that one logs in as the previous user

sounds like basic logic problem, we need to debug this further in other thread.

Quote:
like in C#, it is not forgiving. you have to type in the correct variable or method or class with proper capitalization. it also uses braces that are not that friendly and C# is not that readable too

that's right, but it's very readable to those familiar with the language. same
for the need to use proper case - you get used to it in some point.

Quote:
and in vb, you could design the forms and it generates the codes for you

same in C# - the designer does not care what language is being used.

going to look in your thread later.

Reply With Quote