Solved

Session variables

Posted on 2012-03-16
9
214 Views
Last Modified: 2012-03-20
ASP
If Session("HealthPlanID") = "27" then
Response.Write("  <tr>" & Chr(13))
	Response.Write("    <td align=right><a HREF=" & Chr(34) & "http://localhost:3867/Default1.aspx" & Chr(34) & "><img border=0 src=" & Session("Images") & "rxeob_btn_click.gif></a></td><td>Physicians Look up</td>" & Chr(13))		' Start a PA
	Response.Write("  </tr>" & Chr(13))

end If

Open in new window

ASPX
  protected void Page_Load(object sender, EventArgs e)    
        
        
    {
        
     


         
        Label1.Visible = false;
        if (!IsPostBack)
        {
            SqlDataSource1.SelectCommand = "Select * from tbl_MeriterLogin where 1=2";
            
            
        
        
        }

        if (lname.Text.Length > 1 && fname.Text.Length > 1 && login.Text.Length > 1)
        {
            Response.Write("Please Enter First and Last Name or NPI");
            GridView1.Visible = false;
            Label1.Visible = true;

        }
        else
        {

            GridView1.Visible = true;
        }   
          //string c = Response.ApplyAppPathModifier("http://localhost:1367/PatientDashboard.Web/Default.aspx?session_id=" + sessionId);
        //SeesionID1.Text = sessionStateSection.Cookieless;




        string sessionId = Request.Params["HealthPlanID"];
        TextBox1.Text = sessionId + Request.Params["HealthPlanID"];
          
    }

Open in new window

0
Comment
Question by:mikensu1
  • 3
  • 2
  • 2
  • +1
9 Comments
 

Author Comment

by:mikensu1
ID: 37729289
No data is being passed between pages
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 37729308
Why are you using  Request.Params["HealthPlanID"];


Shouldn't it be  

Session["HealthPlanID"];
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 37729363
What is the question here?
0
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:mikensu1
ID: 37729404
The quetion is how Do I pass data or why is this not working.  When I try
Session["HealthPlanID"] 

Open in new window

I get the following error


Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0266: Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)

Source Error:


Line 43:
Line 44:         string sessionId = Request.Params["HealthPlanID"];
Line 45:         TextBox1.Text = Session["HealthPlanID"];
Line 46:          
Line 47:     }

Source File: f:\Documents and Settings\mshields\My Documents\desktop\Verify_PA\Verify_PA\Default1.aspx    Line: 45


Show Detailed Compiler Output:

Show Complete Compilation Source:



if I try
Session["HealthPlanID"].ToString()

Open in new window

I still get no data.
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 37729442
This:

Session["HealthPlanID"].ToString()

Open in new window


is the proper way to deal with:  "Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)." I should point out, however, that if the "thing" being stored in the "HealthPlanID" is actuall a null reference, then you are going to get an exception when the runtime tries to execute ToString. Be sure to add error checking to that bit of code.

Did you take note of ged325's comment ( http:#a37729308 )?
0
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 37731109
Your ASP and ASPX are in the same project?
0
 

Author Comment

by:mikensu1
ID: 37731119
Yes same project.
0
 
LVL 15

Expert Comment

by:jorge_toriz
ID: 37731311
I can't see in your ASP code anything about assigning a value for your HealthPlanID session variable... first of all, if you are not passing values from ASP to ASPX and vice versa, why do you send both codes?

I can't see the relationship... where do you set the HealthPlanID value?
0
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 37737650
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Video Player 11 23
List<PaisEntity> - show some 1 24
Create a WebAPI using a generic return parameter 9 25
VB.NET 2008 Winforms Signing 13 19
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question