Link to home
Start Free TrialLog in
Avatar of Michael Sterling
Michael SterlingFlag for United States of America

asked on

Why am I losing my session variable value

I'm trying to retrieve a session variable value after a call to something like:

        string myUrl = "http://localhost:59380/RepoEvalPrintPDF.aspx";

But I'm losing the value, can anyone tell me why and or how to fix this? I've used session variables in the past with no problem, but maybe not when I make this kind of call after setting the value. Any help would be appreciated.
Avatar of HainKurt
HainKurt
Flag of Canada image

where is the code to store it into session?

session["myUrl"] = "http://localhost:59380/RepoEvalPrintPDF.aspx";

then use it by session["myUrl"]
Avatar of Michael Sterling

ASKER

Huseyin:

     This is what my code looks like now:

        Session["AppraisalNum"] = lblApprNum.Text;

        string myUrl = "http://localhost:59380/RepoEvalPrintPDF.aspx";


However, when I get to the RepoEvalPrintPDF.aspx page, my session variable's values is gone.
However, when I get to the RepoEvalPrintPDF.aspx page, my session variable's values is gone.

how do you use it?

you should just use this any time...

Session["AppraisalNum"]
whats the purpose of this code?

string myUrl = "http://localhost:59380/RepoEvalPrintPDF.aspx";

Open in new window


it is not stored in session and it is not used...
why you keep posting this line? I am confused...
string myLocalVar = Session["AppraisalNum"].ToString()

That's how I use it, but the value is gone/null.
That line is for use within a document convterter tool that I'm using
this is the full method

        

Session["AppraisalNum"] = lblApprNum.Text;

        string myUrl = "http://localhost:59380/RepoEvalPrintPDF.aspx?reaprno=999999";
        Neevia.docConverter DC = new Neevia.docConverter();                             //
        string docID = "RepoEvaluationReport" + ".url";

        string strCheckStatPage = "";

        DC.setParameter("DocumentOutputFormat", "PDF");

        DC.setParameter("DocumentOutputFolder", Server.MapPath("."));

        DC.setParameter("PDFAutoRotatePage", "All");

        int rVal;
        rVal = DC.submitURL(myUrl, docID, "");
        if (rVal != 0) Response.Redirect("error.aspx?" + rVal);

        strCheckStatPage = "checkStatus.aspx?docid=" + docID;

        Response.Write("<script>");
        Response.Write("window.open('" + strCheckStatPage + "','_blank')");
        Response.Write("</script>");

Open in new window

line 3, you assign it...
where do you use it?

also, why your link is like "http://localhost:59380"

what happens if you use
string myUrl = "/RepoEvalPrintPDF.aspx?reaprno=999999";
I attempt to use it in the Page_Load event of my RepoEvalPrintPDF.aspx page. If I use "/RepoEvalPrintPDF.aspx?reaprno=999999";
pgwscncld.PNG
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.