|
| Using Windows Authentication Mode for internal Form need to capture currently logged in user for data |
 |
Thu, 3 Apr 2008 02:31:22 +0000 |
I have created a form that an instructor can select their course and then go to
another screen to enter data regarding that course. I need to be able to use
windows authentication so the instructor can view only their courses.
I have tried using membership controls and assigning to a label and then
assigning the label control to the grid view's object data source parameter
source but returns null value. The web site is set up to use windows only and
annonomous is unchecked. I also tried using the system control LOGON_USER and
still returns null value. I can see the currently logged in user if i just use
the login, or membership or LOGON_USER but cannot pass the value to the Data
source.
Can you please help with any suggestions? The following was my last attempt
which gives me a SQL error.
ASPX Source page:
<asp:Label ID="Label1" runat="server"
Text="Label"></asp:Label>
<asp:ObjectDataSource ID="ObjectDataSource1"
runat="server"
OldValuesParameterFormatString="original_"
SelectMethod="GetInstructorbyWID"
TypeName="InstructorBLL">
<SelectParameters>
<asp:ControlParameter ControlID="Label1"
Name="wid" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
ASPX.CS page:
public partial class Loggedinas : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
MembershipUser currentUser = Membership.GetUser();
Label1.Text = currentUser.UserName;
}
}
|
| Post Reply
|
|
|
|
|
|
|
|
|
|