Click here to Skip to main content
15,889,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one authoring tool name lectora publisher and I am fetching some data from it to my c# application. I have settings in lectora that after pressing a button, a new window will open and there I will show fetched value in a Label. i am fetching data by Request.Form[]. Now I have some issues.
1) In chrome, when I debug it, the values come correct and program runs nicely but it doesnt open a new window and thus no displaying of the label. (even if I chose the setting to open it in the same window, it doesnt work in chrome.
2) In IE9 and mozilla, it opens a new window but blank one. No label shows. Also, while debugging i saw that at first round it doesnt fetch values and then it again goes to the starting of the code and at that time fetches the value.

P.S Lectora allows me to publish my title in html, so I publiced it and put it in my c# application folder. In which, I have given path of my c# page (localhost) where I wrote this label's code.

Code is here.
protected void Page_Load(object sender, EventArgs e)

{
    //get the parameters posted from the test

    string testname = Request.Form["TestName"];

    Label1.Text = testname;
}
Posted
Comments
JasonMacD 15-Oct-13 9:56am    
Why not use Session instead of Request.Form. I personally have never used nor seen Request.Form in use(although I'm sure it has value being used), but I always have success with session. Example in your scenario:

Add testname session from your inital lectora form: Session.Add("TestName",testName.Text);

Use Session in your next page: Label1.Text = Session["TestName"].ToString();
JL_Coder 16-Oct-13 1:43am    
Ok but what I am trying is to fetch one value that is "TestName" from some third party tool(i.e Lectora), after fetching that value(the value will be "Test 1") I need to show the value in a Label. How do I do it using session? i tried your code, but testname.Text is not allowed.

1 solution

Request.Form returns a NameValueCollection. I have performed what you want earlier using Request.QueryString:
C#
protected void Page_Load(object sender, EventArgs e)
 
{
    //get the parameters posted from the test

    Label1.Text = Request.QueryString["TestName"];
 
}

If no parameter is given in the page call you will get an empty Label1.Text
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900