asp.net中的浏览器问题或代码问题?需要建议。 [英] browser issue in asp.net Or code issue? Need suggestions.

查看:55
本文介绍了asp.net中的浏览器问题或代码问题?需要建议。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个创作工具名称lectora publisher,我从中获取一些数据到我的c#应用程序。我在lectora中有设置,按下按钮后,将打开一个新窗口,我将在标签中显示获取的值。我正在通过Request.Form []获取数据。现在我有一些问题。

1)在chrome中,当我调试它时,值正确并且程序运行良好但它没有打开一个新窗口,因此没有显示标签。 (即使我选择了在同一个窗口中打开它的设置,它也不能用于chrome。

2)在IE9和mozilla中,它会打开一个新窗口但是空白。没有标签显示。此外,在调试时我看到它在第一轮它没有获取值,然后它再次进入代码的开始,并在那时取值。



PS Lectora允许我用html发布我的标题,所以我把它公开并放在我的c#应用程序文件夹中。其中,我已经给出了我的c#page(localhost)的路径,在那里我写了这个标签的代码。



代码就在这里。

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;
}

推荐答案

Request.Form返回NameValueCollection。我已经使用Request.QueryString执行了您想要的操作:

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

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



如果页面调用中没有给出参数,你将得到一个空的Label1.Text


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


这篇关于asp.net中的浏览器问题或代码问题?需要建议。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆