Hi,
I have one navigationmenu on my masterpage. Whenever a user logins, the navigationmenu should display the menuitems as per the users permission.

eg: i have three navigationmenu items i.e. menuitem1, menuitem2, menuitem3.
a normal user has access only to two menuitems i.e. menuitem1 and menuitem2. And the third menuitems is either disable or hidden to him.

So when a user logins, he can only see two menuitems i.e. menuitem1 and menuitem2.
My Program: wht I did is I wrote user authentication code on my login.aspx page
i.e.


If lbl.Text = "user" Then
nwperm()
Response.Redirect("Home.aspx")
end if

HERE nwperm is a function which i wrote in the class file located in App_Code folder.


Sub nwperm()

Dim mymenu As Menu = Master.FindControl("NavigationMenu")

Dim mymi As MenuItem = mymenu.FindItem("TechnicalSupport")

mymi.Enabled =True

end sub

Problem/error: object reference cannot create an instance of an object.
Plz help me...

On which line of code do you get the error?

On which line of code do you get the error?

code written in my class file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.