DesignCoding Studio

一切只要去努力!

定制颜色:
[ 显示模式: 摘要 | 列表 ]
分页:1/1
1
2009-06-30

C#向网址Post提交二进制数据

时间: 2009-6-30 0:30:11 作者: admin 阅读次数: 445

 

private string SendReq(string ReID,string sp_id, string dest_mobile, string fee_mobile, string service,string send_DeviceID)
        
{
            
string sReturn = "";
            
try
            
{
                
string sURL = txtDsmp.Text;
                sURL
= sURL.Trim();
                Uri Url
= new Uri(sURL);
                HttpWebRequest hwReq
= (HttpWebRequest)WebRequest.Create(sURL);
                hwReq.Method
= "Post";
                hwReq.ContentType
= "text/xml;charset=utf-8";
                hwReq.KeepAlive
= false;
                
//hwReq.CachePolicy.Level = System.Net.Cache.RequestCacheLevel.Default;
                hwReq.Timeout = 6000;
                
                StringBuilder xmlStr
= new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
                xmlStr.Append(
"<root>");
                xmlStr.Append(
"<name>");
                xmlStr.Append(
"username");
                xmlStr.Append(
"</name>");
                xmlStr.Append(
"</root>");
                StringBuilder postData
= new StringBuilder(1000);
                postData.Append(xmlStr);
                hwReq.ContentLength
= postData.ToString().Length;

                Stream _RequestStream
= hwReq.GetRequestStream();
                _RequestStream.Write(Encoding.UTF8.GetBytes(postData.ToString()),
0, postData.ToString().Length);
                _RequestStream.Close();

                
string strPost = "", strReceive = "";
                strPost
=postData.ToString();

                HttpWebResponse hwResp
= (HttpWebResponse)hwReq.GetResponse();
                StreamReader reader
= new StreamReader(hwResp.GetResponseStream(), System.Text.Encoding.UTF8);
                
while (reader != null && !reader.EndOfStream)
                
{
                    
string s = reader.ReadLine();
                    strReceive
=s;
                }

                sReturn
= strReceive;
            }

            
catch (Exception ex)
            
{
                MessageBox.Show(ex.Message);
                sReturn
= "Error!";
            }

            
return sReturn;
        }

[阅读全文]
2008-01-23

自定义控件OutLookBar

时间: 2008-1-23 22:47:51 作者: admin 阅读次数: 1470

仿微软OutLookBar的控件

namespace ctListBar
{
    
public partial class OutLookBar : Panel
    
{
        
public OutLookBar()
        
{
            buttonHeight
= 25;
            selectedBand
= 0;
            selectedBandHeight
= 0;
            InitializeComponent();
        }

        
private int buttonHeight;
  
private int selectedBand;
  
private int selectedBandHeight;

  
public int ButtonHeight
  
{
  
get
  
{
    
return buttonHeight;
   }


  
set
  
{
    buttonHeight
=value;
    
// do recalc layout for entire bar
   }


[阅读全文]
2008-01-23

自定义IP输入控件

时间: 2008-1-23 22:44:09 作者: admin 阅读次数: 840

自定义IP输入框控件,它继承了Panel控件

    /// <summary>
    
/// IP地址输入控件 Written by DesignCoding
    
/// </summary>

    [ToolboxBitmap("ip.bmp")]//注意:参数为你的位图路径,在我的实验里,它与所生成的Test.Dll文件在同一个目录下  
    public partial class TextBoxIP : System.Windows.Forms.Panel
    
{
        
protected TextBox txtIp1 ;
        
protected TextBox txtIp2 ;
        
protected TextBox txtIp3 ;
        
protected TextBox txtIp4;
        
protected Label lbDian1;
        
protected Label lbDian2 ;
        
protected Label lbDian3;
        
/// <summary>
        
/// 表示IP地址的类型为A、B、C或D类地址
        
/// </summary>

        public enum IPType : byte { A, B, C, D };

        
public TextBoxIP()
        
{
            InitializeComponent();
        }


[阅读全文]
2007-12-09

移动网关CMPP3.0(原码)

时间: 2007-12-9 17:51:55 作者: admin 阅读次数: 1694

    以前在SP运营商工作了3年,现在不干,把我研究的CMPP3.0共享给大家.以便大家可以学习.
程序是用 VS.Net 2005 + MSSQL开发的.有什么不懂的地方大家可以给我留言.


[阅读全文]
2007-12-06

移动网关 CMPP30 类

时间: 2007-12-6 22:31:55 作者: admin 阅读次数: 658
中国移动CMPP3.0类

namespace Cmpp.Components
{
/**//// <summary>
/// CMPP30 的摘要说明。
/// </summary>

public class CMPP30
{
变量以及初始值

构造函数


[阅读全文]
2007-11-06

C# XP分格 C# manifest

时间: 2007-11-6 21:56:04 作者: admin 阅读次数: 730

C# manifest
1. Open your exe in VS (file -> open file)
2. Right click on it and select add resource
3. Click "Import..." from the dialog
4. Select your manifest file
5. In the "Resource Type" field, enter "RT_MANIFEST"
6. In the property grid, change the resource ID from "101" to "1".
7. Save the exe.


[阅读全文]
2007-06-06

SMS发送WapPush

时间: 2007-6-6 11:17:56 作者: admin 阅读次数: 664

SMS发送WapPush
首先要将这两个字段设置为"1"
tp_Pid = 1;
tp_Udhi = 1;短信内容编码要设置为:4也就是二进制MessageFmt=4;
然后对要发送的WapPush进行编码


[阅读全文]
分页:1/1
1