Click here to Skip to main content
13,048,846 members (77,067 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am facing a problem with a small project whose aim is to allow students to communicate with their supervisors whilst they are undertaking their projects. For security purposes, I am using the Membership from Microsoft. I have a STUDENT and STAFF tables that are linked to the ASPNET USERS membership table. The login works fine, and the access to the different folders is restricted accordingly.

Re: Tables STUDENT to BLOG

I need help regarding how to store session variable as StuId, instead of username.

This is the blog page form code:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
 AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="BlogID" 
 <asp:BoundField DataField="BlogID" HeaderText="BlogID" InsertVisible="False" 
 ReadOnly="True" SortExpression="BlogID" />
 <asp:BoundField DataField="BlogDate" HeaderText="BlogDate" 
 SortExpression="BlogDate" />
 <asp:BoundField DataField="BlogDesc" HeaderText="BlogDesc" 
 SortExpression="BlogDesc" />
 <asp:BoundField DataField="StuID" HeaderText="StuID" SortExpression="StuID" />
 <asp:BoundField DataField="BlogTitle" HeaderText="BlogTitle" 
 SortExpression="BlogTitle" />
 <br />
 <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
 ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
 SelectCommand="SELECT * FROM [Blog] WHERE ([StuID] = @StuID)">
 <asp:SessionParameter Name="StuID" SessionField="StuID" Type="Int32"/>

Currently if i use in my code behind my blog page:
Session("UserName") = System.Web.HttpContext.Current.User.Identity.Name

It returns a blank page as username is not part of my student or staff table. I have to run a query to link the userID of both STudent and asp.users to get this right. It becomes problematic if i want to insert in the blog.
Posted 1-Apr-13 9:37am
Updated 1-Apr-13 9:39am
Deependra Khangarot 2-Apr-13 0:17am
Membership provides a convenient mechanism for storing information per user in a Web application, the design of your application require that additional user information be stored with the user authentication information in the Membership data store. In this case, you would need to build a custom membership provider to store and retrieve the user authentication information and the additional user values in your data store.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 1 Apr 2013
Copyright © CodeProject, 1999-2017
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