Click here to Skip to main content
11,633,786 members (76,219 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET VB.NET
Hi all,

can someone help me on this's been a week.i dont know how to solve this..
my login page is reach to human resource table (oracle) then i compare (role) to my own table..
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim con As New OracleConnection(OracleString)
        Dim log As String
        log = "Select Distinct J.Emplid, P.Name, " +
        "C.Descr Dept From PS_JOB J, PS_JOB JD " +
        "Where J.Emplid = '" + Request("UID") + "' "
        Dim cm As New OracleCommand(log, con)
        cm.Connection = con
        'cm.CommandText = log
        'Dim name As String = DirectCast(cm.ExecuteScalar(1), String)
        'Label1.Text = DirectCast(cm.ExecuteScalar(1), String)
        Dim d As OracleDataReader = cm.ExecuteReader()
        Label1.Text = d.GetString(1)
        Label4.Text = d.GetString(3)
        Session("sEmplid") = d.GetString(0)
        'Dim cm As New OracleCommand()
        'cm.Connection = con
        'cm.CommandText = log
        'Dim id As String = DirectCast(cm.ExecuteScalar(0), String)
        'Label3.Text = DirectCast(cm.ExecuteScalar(0), String)
        Session("sNama") = Label1.Text
        Session("sDept") = Label4.Text
        'Session("sEmplid") = Label3.Text


    End Sub
    Protected Sub checkrole()
        Dim role As String
        Dim con As New SqlConnection(connectionString)
        If (Session("sEmplid") <> "") Then
            Dim r As String = "Select roles from logs where Emplid = '" + Session("sEmplid") + "'"
            Dim c As New SqlCommand(r, con)
            c.Connection = con
            Dim d As SqlDataReader = c.ExecuteReader()
            If DBNull.Value.Equals(d("roles")) Then
                Label2.Text = "user"
                role = Label2.Text
                Session("sRole") = role
                Label2.Text = d.GetString(0)
                role = Label2.Text
                Session("sRole") = role
            End If
        End If

        If (Session("sRole") = "user" Or Session("sRole") = "manager" Or Session("sRole") = "general" Or Session("sRole") = "master") Then
        End If
    End Sub
<sitemap enabled="true">
                <clear />
                <add sitemapfile="Web.sitemap" name="AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider" securitytrimmingenabled="true" />
        <authentication mode="Forms">
            <forms name ="pageForm" loginUrl="~\login.aspx" defaultUrl="~\home.aspx"></forms>


    <location path="approval.aspx">
                    <allow users="master" />
                    <deny users="*" />

<sitemap xmlns="">
    <sitemapnode roles="*">
        <sitemapnode url="home.aspx" title="Home" description="" />
        <sitemapnode url="status.aspx" title="Status" description="" />
        <sitemapnode title="Approval by GM ISM" description="GM ISM Use Only" url="approval.aspx" />
        <sitemapnode url="logout.aspx" title="Logout" description="" />


the problem is; whenever i login (no matter what user id) the menu appear for role user. seems like role master doesnt work at all in web config..please help me..

Posted 15-Oct-12 0:14am
Edited 15-Oct-12 4:29am
n.podbielski at 15-Oct-12 6:52am
And you did wrote your own SqlRoleManager?
musiw at 15-Oct-12 10:34am
in logs table, there is column for roles..master,manager,general.the rest is user. whenever i login (try multiple emplid with different roles)it is not working..i can tell by looking at the menu. i write xml file menu which approval.aspx only for master,general.the rest of the menu for all.currently my menu only appear for user master didnt appear

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

From briefly looking over what you have done, it looks like you forgot to authenticate the user using FormsAuthentication.SetAuthCookie after you set the session variables and roles.

Here is a link to a CP article on forms authentication with SQL Server, but you should be able to replace the SQL part with your Oracle code.

FormsAuthentication.SetAuthCookie(username, false);[^]

Best of luck!
musiw at 22-Oct-12 2:52am
i already tried your link still no success... :( i dont know how to solve this..
mgoad99 at 22-Oct-12 17:09pm
I think n.podbelski's comment about the role manager is helpful. It seems like you may need to implement a custom membership provider. I'm sorry I can't help you more. But, that may be something to check into. Good luck.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,658
1 Sergey Alexandrovich Kryukov 8,204
2 Mika Wendelius 6,645
3 F-ES Sitecore 2,321
4 Suvendu Shekhar Giri 2,095

Advertise | Privacy | Mobile
Web04 | 2.8.150728.1 | Last Updated 15 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100