.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Problem in display Full Name after logged in (Session Problem)

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :ASP.Net

After login, i have create a session to display the Username of the logged user, however instead of display the Username, i want to display the Full_Name of the logged user

However i have no idea how it dones....Kindly if you could help me in giving suggestion / ideas. Thank you.

PersonUser Table

P_ID (PK)   =1

Username =lucy88

Password =88ycul

Full_Name = Lucy

User_Type =Admin

Login.aspx - as i do session, it will display lucy88 however i would like to display Full_Name which is Lucy.


    protected void Button1_Click(object sender, EventArgs e)
        SqlDataSource sds = new SqlDataSource();
        sds.ConnectionString = ConfigurationManager.ConnectionStrings["MyDB"].ToString();
        sds.SelectParameters.Add("Username", TypeCode.String, this.TextBox1.Text);
        sds.SelectParameters.Add("Password", TypeCode.String, this.TextBox2.Text);

        sds.SelectCommand = " SELECT * FROM [PersonUser] WHERE [Username] = @Username AND [Password] = @Password";
        DataView dv = (DataView)sds.Select(DataSourceSelectArguments.Empty);

        if (dv.Count

View Complete Post

More Related Resource Links

Session problem with display of image in row of reportviewer


Hello techies...

I am new to this sql reporting service. But anyhow by surfing I am able to bind the report but i was stuck in image display.

Anyways, i also managed that. But the real problem is whenever i was keeping a image control in rdlc report i was having session prob. If i remove the image control then as usual report works fine.

Please suggest me some solution.... either for session problem or for image display. I am keeping the image name in database but for binding the rdlc report i am using a store procedure which return the path (static) concating with the image name(kept in database).

Hope to find a solution .....

SQL Server Session state problem.


Hi to all,

I have some things that I want to know. I am right now using a free asp.net webhosting ("somee.com"). The problem is that when I am visiting a page, there's a tendency that values stored in my session variables are lost. Therefore, it causes an error when the requested page is loaded.

1. I am thinking of using sessionState mode="SqlServer". Will it solve my problem?

Actualy Im working on it but Im having problems when connecting to the sql database.

2.  Is that a problem in the webhost?

3. Do free webhosting sites provide allow session state in the sql server?. Because ive tried it locally into my computer and error say's i should intall the ASP.NET Session State SQL Server version 2.0 or above.

Problem with Session and PageMethod


Hi All,

I'm trying to show some data in the update panel refreshing every second using page method. Everything works fine until I introduce Session. As soon as I save some data into the session my Ajax Page method is not called every second. Here is the complete code


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script type="text/javascript" language="JavaScript">
        function UpdateStatus() {
            setTimeout("UpdateStatus()", 1000);

        function ShowStatus(sCurrentStatus) {
            document.getElementById('lblStatus').innerHTML = sCurrentStatus;
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True&q

Session Problem with IE 6 and IFrames


hi folks

i've a problem with session objects in my asp .net 2.0 webapplication. when i open my webapplication in a IFRAME and IE, it doesn't work, because my session object is NOTHING.

what's wrong ? what can i do ?

Kind regards

Session State Problem




I just for the first time into a session state problem. So I am hoping someone

here has the answer.


I have written an ASP.Net website and tried to implement the common poor mans online user count.
The problem I am having is the following.

On App_Start I create a variable and assign it the value of 0;

Then increase the number on session_start and decrement on session_end.

On my local IIS it works perfectly from IE8 and Opera. The value increments correctly.
As soon as I upload to my live server. The value increments on every link I click and every page refresh when I test with IE8.
This does not happen when testing with Opera.

Could someone please shed some light on the subject.




Louis Lews

session lost problem


hi there,

i have an application that uses sessions.

i have set at the web.config: 

<forms loginUrl="Default.aspx" protection="All" timeout="30" name=".ASPXFAUTH" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="Default.aspx" cookieless="UseCookies" enableCrossAppRedirects="true"/>

and at the global.asax.vb

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        Session.Timeout = 30

end Sub

and at default.aspx.vb

Protected Sub LoginButton_Click(ByVal sender As Object, ByVal e As EventArgs)
        Session("userName") = Login1.UserName
        Session.Timeout = 30 ' minutes of session '

    End Sub

At a local iis on windows xp works fine,

but when i publish it at the webserver i am redirected to the default page after about 30 sec!!!

any ideas?


checkboxlist full post back problem is association with PopupControlExtender


I have used a checkboxlist in association with PopupControlExtender. All the items are inside the update panel. I used the server side SelectedIndex changed event of checkbox list for another purpose.  But it cause full post back while checking the check box item. The update panel doent make any sense here.

        <asp:ScriptManager ID="Scriptmanager1" runat="server">
        <asp:UpdatePanel ID="UpdatePanel3" runat="server">

[VS2008] Designer's display problem

Hello, I created a solution with multi-project and i've recently added some resources files to lacalized my application and of course my XAML files too. I used the "How To:" http://msdn.microsoft.com/en-gb/library/dd882554(v=VS.95).asp I inserted the class LocalizedString in one off my project that I use as library for common actions. But since, my designer is not loading properly because it can't find this class while I precised the good assembly and that the application is running properly with resources applied. It's then not handy to develop an HMI... If anybody has an idea about this trouble... Of course I tried dozens of times to clear the projects and regenerate without success. Thank you for your help !

Problem with GridView display

I have a calendar control where a user selects a date and then inputs info into a FormView control. Underneath the FormView is a GridView that shows all data from the SelectedDate on the calendar control. However, when the date is selected, all the information from the table ( from all dates ) is displayed. Any ideas on why? Code is below and thanks:<asp:Calendar ID="calendarInstallDate" runat="server" BackColor="White" BorderColor="Black" DayNameFormat="Shortest" Font-Names="Times New Roman" Font-Size="10pt" ForeColor="Black" Height="220px" NextPrevFormat="FullMonth" TitleFormat="Month" Width="400px" onselectionchanged="calendarInstallDate_SelectionChanged" > <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" ForeColor="#333333" Height="10pt" /> <DayStyle Width="14%" /> <NextPrevStyle Font-Size="8pt" ForeColor="White" /> <OtherMonthDayStyle ForeColor="#999999" /> <SelectedDayStyle BackColor="#CC3333" ForeColor="White" /> <SelectorStyle BackColor="#CCCCCC" Font-Bold="T

Ajax Session timeout problem

Hi,  I have some problems when using AJAX with updatepanels. I have an ASP.NET webapplication with a login that uses form authentication with the timeout set to 5 min. After 5 min of idle the site should be redirected to the login.aspx page. My problem is that after using the site for 5 minutes when clicking on contents inside an updatepanel I get a messagebox with the following error: A Runtime Error has occurred.Do you wish to Debug? Line: 4723Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 12031  I think that it has something to do with the ajax updatepanel since when I remove the updatpanels this problem does not appear. Instead the site is redirected to login.aspx as expected. When searching on the problem on google I see alot of people having similar problem, but I haven't found suitable solution. Any suggestions?

problem in join two pages with session

hi every body I have two web pages one for inbox messages and second for details for one message in first page I have gridview include name the sender , address the message and details message alongside with buttonfield to go  to another page to view  full message the code of gridview<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1" Width="648px" onrowcommand="GridView1_RowCommand"> <Columns> <asp:BoundField DataField="sender" HeaderText="sender" SortExpression="sender" /> <asp:BoundField DataField="address" HeaderText="address" SortExpression="address" /> <asp:BoundField DataField="details" HeaderText="details" SortExpression="details" /> <asp:ButtonField Text="More..." CommandName="Show_More" /> <asp:TemplateField ShowHeader="False"> <ItemTemplate> </ItemTemplate>

Weird problem with session cookie

Hi all,I'm having a weird problem with my web application, and I can't find the solution to it.I'm using a Java applet to read some data from an electronic ID. This applet posts its captured data to a HttpHandler class and stores the data back in some session variables. It all works smoothly, unless in some cases.Every time a do a new publish to the webserver or the website isn't touched for some time. There is a problem with the session.The applet can't find a session cookie, and so it crashes.I did some tests and indeed, the cookie ("ASP.NET_SessionId") does not exists. But it seems that other session variables (user login, etc) are working fine.To make sure that the cookie for the session ID is readable from the applet I do the following in the global.asax: Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a new session is started Dim isSessionFound As Boolean = False If Response.Cookies.Count > 0 Then For Each s As String In Response.Cookies.AllKeys If s = "ASP.NET_SessionId" Then Response.Cookies("ASP.NET_SessionId").HttpOnly = False isSessionFound = True 'just for test End If Next End If End SubI tried to do something with the isSessionFound, wh

AutoCompleteExtender ContextKey with Session Problem

I have a aspx page with an AutoCompleteExtender and I retrieve users from database.While user log in, I get user's id from database and set to Session["iduser"]. I want to use Session["iduser"] as a contextkey in AutoCompleteExtender. I tried different ways for this but it didn't work...Also I am using a updatepanel.<asp:ScriptManager ID="ScriptManager1" runat="server">    <Services>     <asp:ServiceReference Path="WebService.asmx" />    </Services>    </asp:ScriptManager>my source code:<asp:TextBox ID="txtPost" runat="server"  CssClass="form_text_ozellik"         BackColor="Transparent" BorderStyle="None"></asp:TextBox>     <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtPost" ServicePath="WebService.asmx" ServiceMethod="GetUsers"   MinimumPrefixLength="1" CompletionSetCount="12"  DelimiterCharacters="," UseContextKey="true" CompletionInterval="200" EnableCaching="true">    </cc1:AutoCompleteExtender>my web service code:[We

problem with dimenssion Display Values



I Have built a cube and deploy it to 2008 Olap Server.  the dimenssion data looks great .

while deploying the same cube / project to another server (2005 server) the dimenssion data

displayed ?????????????? instand of the correct value. the correct value is in hebrew language.

i check the collation in 2005 server and it support Hebrew Language.

what can be the reason to that?


Win7, IE8 display formatting problem


We only have one Win7 box in the company and it does not want to display our sharepoint 2003 pages correctly. It’s not consistent either, some times it will load correct and other times it won’t. When it’s working right, the pages load quickly, when its not, the pages load real slow or not at all. When they don’t load correct, it’s like the CSS or something along them lines is messed up. The colors are not correct, the text is larger and not where it should be.


The Win7 box has all the latest updates. I’m not sure what patch level the server and sharepoint are at, I don’t manage them myself.

Problem in displaying username after logged in


I having problem in display the username after a user logged in. Can anyone give some suggestions. Also, few lines of code will be appreciated.

This is my master page which has label which named Label1 on top right, i want to display the username on there after logged in. 


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class MasterPage : System.Web.UI.MasterPage
    protected void Page_Load(object sender, EventArgs e)
        Label1.Text = Session["Username"].ToString();
    protected void lbtnLogout_Click(object sender, EventArgs e)


It will display Object reference not set to an instance of an object when build the website.

Here is the Login Page

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using Syste

Message Display Problem



I am facing a  strange problem .i use following code for show successfully message to user.so it is working fine but problem is when I go another page and came back same page again  through  browser back button again successful message display.

For example suppose there are two page i.e one.aspx nad two.aspx.  i  save one.aspx record then message display me that "Record Insert Sucessfully!!" then I go to two.aspx and when I came back again one.aspx by browser back button again same message are display again

please someone help me.

Script for message

ClientScript.RegisterStartupScript(Me.GetType(), "alert", "<script language='javascript'>alert('Record Updated Sucessfully..')</script>")

Use like

Public Sub SAVEDATA()



            MYTRANS = myConnection.BeginTransaction()






ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend