请告诉我如何获取URL中的数据

请告诉我如何获取URL中的数据

本文介绍了请告诉我如何获取URL中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected void btnget_Click(object sender, EventArgs e)
        {
            string url=string.Empty;
            string fromDate,toDate= string.Empty;
            if (chkdate.Checked)
            {
                fromDate = txtfrom.Text;
                toDate = txtto.Text;
                DateTime startDate = Convert.ToDateTime(txtfrom.Text);
                DateTime endDate = Convert.ToDateTime(txtto.Text);
                TimeSpan ts = endDate.Subtract(startDate);
                if ((txtfrom.Text.Substring(0, 10) != System.DateTime.Now.Date.ToString("MM/dd/yyyy")) && (txtto.Text.Substring(0, 10) != System.DateTime.Now.Date.ToString("MM/dd/yyyy")))
                {
                    if (Convert.ToInt16(ts.ToString().Substring(0, 1).ToString()) < 3)
                    {
                        DateTime dt = System.DateTime.Now.AddMonths(-6);
                        if (startDate > dt || endDate > dt)
                        {
                            fromDate = startDate.ToString("dd/MM/yyyy").Replace("-","/");
                            toDate = endDate.ToString("dd/MM/yyyy").Replace("-", "/");

                            url = "http://api.smscountry.com/reports.aspx?user=sa&passwd=sa&fromdate=" + fromDate+" 00:00:00" + "&todate="+toDate+" 23:59:59";
                            ScriptManager.RegisterStartupScript(((Button)sender), sender.GetType(), "sc1", "window.open('" + url + "')", true);

                        }
}

推荐答案

string Uid = Request.QueryString["user"];
string Pwd = Request.QueryString["passwd"];


这篇关于请告诉我如何获取URL中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 08:17