Where i am doing wrong can any body help me

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dhanu sahu
    New Member
    • Mar 2008
    • 14

    Where i am doing wrong can any body help me

    I am developing webpage in c#,asp.net,and want to pass session value to page2,but where i doing wrong,its showing error

    Page 1:
    int Empid;string EmployeeName

    Session["usid"] = Empid.ToString( );
    Session["userId"] = EmployeeName.To String();
    Response.Redire ct("membermain. aspx");


    Page-2

    Public WelcomeName As String


    If (Session("usid" ) = "" )
    { Response.Redire ct("Default.asp x")

    }
    WelcomeName = Session("UserID ")
  • int08h
    New Member
    • Apr 2007
    • 28

    #2
    in page2, you get session value like this:

    string userid = Session("userid ");

    and this is where you got the error in my opinion, try this

    string userid = Session["userid"];

    notice that you were using () while the correct style is []

    Comment

    • Shashi Sadasivan
      Recognized Expert Top Contributor
      • Aug 2007
      • 1435

      #3
      Originally posted by int08h
      in page2, you get session value like this:

      string userid = Session("userid ");

      and this is where you got the error in my opinion, try this

      string userid = Session["userid"];

      notice that you were using () while the correct style is []
      I think the Op is using vb .net and c# version of () is []

      Have you tried using userid in the same case (lowercase / uppercase / mixedcase)
      notice u use userid in the main page and UserId in page 2.
      still not exactly sure about it.

      Comment

      Working...