Forum Moderators: open
I have two pages login.aspx which contain the membership login control with SQL database, and second page data.aspx which contain FormView.
I need to use SessionParameter to pass the UserName and do some filteration to display the required information.
The fields are UserName, Passwords, Email, Address.
Any help?
here is my code in data.aspx.c
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String UserName = Page.User.Identity.Name;
Response.Write(UserName);
}
}
regarding the dayasource code in the formview I wrote:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString %>"
SelectCommand="SELECT UserName, Email, Phone FROM Data WHERE UserName = @UserName)">
<SelectParameters>
<asp:SessionParameter Name="UserName" SessionField="UserName" Type="String" Size="50" />
</SelectParameters>
</asp:SqlDataSource>
The problem that when I check the session by using
Response.Write(UserName);
it will disply it correctly, but I can't pass it to the SQL and all what I got is blank page!
Thank you again