明天的明天 永远的永远 未知的一切 我与你一起承担 ??

是非成败转头空 青山依旧在 几度夕阳红 。。。
posts - 403, comments - 69, trackbacks - 2, articles - 0
  博客园 :: 首页 ::  ::  ::  :: 管理

最新评论

共2页: 1 2 下一页 
找了好久了,忘记叫啥名了,一看截图,就它!
我就不想显示序号这一列,该怎么改。
感谢 这个“追加” 帮了大忙
非常有效~谢谢博主
这。。。。。。。。。。。。。
谢谢了 netlater@126.com
精彩
我也要一个,谢谢.
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; using System.Drawing; public partial class MarkImage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } /// <summary> /// 保存图片 " 图片水印 " /// </summary> /// <param name="InUploadImagePath">原服务器图片路径</param> ///<param name="inLogoImagePath">生成的带图片水印的图片路径</param> /// <param name="InSavePath">水印图片路径</param> public static void MarkToImage(string InUploadImagePath, string inLogoImagePath, string InSavePath) { FileStream fs = new FileStream(HttpContext.Current.Server.MapPath(InUploadImagePath), FileMode.Open, FileAccess.ReadWrite); System.Drawing.Image img = System.Drawing.Image.FromStream(fs, false, false); Bitmap bmp = new Bitmap(img); img.Dispose(); fs.Close(); System.Drawing.Image Image = bmp; System.Drawing.Image newimage = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath(inLogoImagePath)); Graphics g = Graphics.FromImage(Image ); g.DrawImage(newimage, new Rectangle(Image.Width - newimage.Width, Image.Height - newimage.Height, newimage.Width, newimage.Height), 0, 0, newimage.Width, newimage.Height, GraphicsUnit.Pixel); try { Image.Save(HttpContext.Current.Server.MapPath(InSavePath) ); } catch(Exception de) { } finally { g.Dispose(); Image.Dispose(); newimage.Dispose(); } } protected void Button1_Click(object sender, EventArgs e) { MarkToImage("Ld.bmp", "A01.jpg", "Ld.bmp"); } }
using System.IO; using System.Drawing; public partial class MarkImage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } /// <summary> /// 保存图片 " 图片水印 " /// </summary> /// <param name="InUploadImagePath">原服务器图片路径</param> ///<param name="inLogoImagePath">生成的带图片水印的图片路径</param> /// <param name="InSavePath">水印图片路径</param> public static void MarkToImage(string InUploadImagePath, string inLogoImagePath, string InSavePath) { System.Drawing.Image Image = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath(InUploadImagePath)); System.Drawing.Image newimage = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath(inLogoImagePath)); Graphics g = Graphics.FromImage(Image); g.DrawImage(newimage, new Rectangle(Image.Width - newimage.Width, Image.Height - newimage.Height, newimage.Width, newimage.Height), 0, 0, newimage.Width, newimage.Height, GraphicsUnit.Pixel); try { Image.Save(HttpContext.Current.Server.MapPath(InSavePath)); } catch { } finally { g.Dispose(); Image.Dispose(); newimage.Dispose(); } } protected void Button1_Click(object sender, EventArgs e) { MarkToImage("Logo.bmp", "A01.jpg", "C00101.jpg"); } }
Re:js 截取字符串的方法 且行且思 2009-08-26 01:29  
C# 判断数字。。。。 方案二:正则表达式(推荐) a) using System; using System.Text.RegularExpressions; public bool IsNumber(String strNumber) { Regex objNotNumberPattern=new Regex("[^0-9.-]"); Regex objTwoDotPattern=new Regex("[0-9]*[.][0-9]*[.][0-9]*"); Regex objTwoMinusPattern=new Regex("[0-9]*[-][0-9]*[-][0-9]*"); String strValidRealPattern="^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$"; String strValidIntegerPattern="^([-]|[0-9])[0-9]*$"; Regex objNumberPattern =new Regex("(" + strValidRealPattern +")|(" + strValidIntegerPattern + ")"); return !objNotNumberPattern.IsMatch(strNumber) && !objTwoDotPattern.IsMatch(strNumber) && !objTwoMinusPattern.IsMatch(strNumber) && objNumberPattern.IsMatch(strNumber); } b) public static bool IsNumeric(string value) { return Regex.IsMatch(value, @"^[+-]?\d*[.]?\d*$"); } public static bool IsInt(string value) { return Regex.IsMatch(value, @"^[+-]?\d*$"); } public static bool IsUnsign(string value) { return Regex.IsMatch(value, @"^\d*[.]?\d*$"); }
Re:深入学习JS: __doPostBack函数 温景良(Jason) 2009-08-19 15:07  
呵呵,是很好用,我经常用
久旱逢甘霖啊 厉害厉害 学习了
谢谢,解决了一个困扰我的问题原来是ashx的.cs文件是可以分离到app_code里,但我看别人代码时,他又在app_code里加了子目录叫AshxCode,放到子目录里后,ashx文件里只这样写还能行吗? <%@ WebHandler Language="C#" Class="FreshNews" %>
我这样操作过一次,但当时好了,下一次打开的时候有出现了。这不是根本原因所在吧
写得不错,但是好象不通用
re: 动态加载内容页的css样式表 殷良胜 2009-05-28 13:56  
很好
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>

<script>
// Last updated 2006-02-21
function addRowToTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
//row.id="tr_"+ iteration;
row.setAttribute("id","tr_"+ iteration);

// left cell
var cellLeft = row.insertCell(0);
var textNode = document.createTextNode(iteration);
cellLeft.appendChild(textNode);

// right cell
var cellRight = row.insertCell(1);
var el = document.createElement('input');
el.type = 'text';
el.name = 'txtRow' + iteration;
el.id = 'txtRow' + iteration;
el.size = 40;

el.onkeypress = keyPressTest;
cellRight.appendChild(el);

// select cell
var cellRightSel = row.insertCell(2);
var sel = document.createElement('select');
////alert(iteration);
sel.name = 'selRow' + iteration;
sel.options[0] = new Option('text zero', 'value0');
sel.options[1] = new Option('text one', 'value1');
cellRightSel.appendChild(sel);

var cellRightSel = row.insertCell(3);
var sel = document.createElement('select');
sel.name = 'selRowd' + iteration;
sel.options[0] = new Option('text zero', 'value0');
sel.options[1] = new Option('text one', 'value1');
cellRightSel.appendChild(sel);
}
function keyPressTest(e, obj)
{
var validateChkb = document.getElementById('chkValidateOnKeyPress');
if (validateChkb.checked) {
var displayObj = document.getElementById('spanOutput');
var key;
if(window.event) {
key = window.event.keyCode;
}
else if(e.which) {
key = e.which;
}
var objId;
if (obj != null) {
objId = obj.id;
} else {
objId = this.id;
}

displayObj.innerHTML = objId + ' : ' + String.fromCharCode(key);
}
}
function removeRowFromTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
function openInNewWindow(frm)
{
// open a blank window
var aWindow = window.open('', 'TableAddRowNewWindow',
'scrollbars=yes,menubar=yes,resizable=yes,toolbar=no,width=400,height=400');

// set the target to the blank window
frm.target = 'TableAddRowNewWindow';

// submit
frm.submit();
}
function validateRow(frm)
{
var chkb = document.getElementById('chkValidate');
if (chkb.checked) {
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length - 1;
var i;
for (i=1; i<=lastRow; i++) {
var aRow = document.getElementById('txtRow' + i);
if (aRow.value.length <= 0) {
alert('Row ' + i + ' is empty');
return;
}
}
}
openInNewWindow(frm);
}

function rowsTest(e, obj)
{
//var row = document.getElementById('tr_1');
//alert(row);

//var row2 = document.getElementById('txtRow1');
//alert(row2);
var tbl = document.getElementById('tblSample');
for(var i = tbl.rows.length-1; i >=0; i--)
{ alert(tbl.rows[i].id);}
}

</script>

</head>
<body>
<form id="form1" runat="server" action="Default.aspx" method="get">
<div>
<p>
<input type="button" value="读取id" onclick="rowsTest();" />
<input type="button" value="Add" onclick="addRowToTable();" />
<input type="button" value="Remove" onclick="removeRowFromTable();" />
<input type="button" value="Submit" onclick="validateRow(this.form);" />
<input type="checkbox" id="chkValidate" /> Validate Submit
</p>
<p>
<input type="checkbox" id="chkValidateOnKeyPress" checked="checked" /> Display OnKeyPress
<span id="spanOutput" style="border: 1px solid #000; padding: 3px;"> </span>
</p>
<table border="1" id="tblSample">
<tr>
<th colspan="3">Sample table</th>
</tr>
<tr>
<td>1</td>
<td><input type="text" name="txtRow1"
id="txtRow1" size="40" onkeypress="keyPressTest(event, this);" /></td>
<td>
<select name="selRow0">
<option value="value0">text zero</option>
<option value="value1">text one</option>
</select>
</td>
</tr>


<tr id="darenkuang18" >
<td height="30"><div align="center">
<input name="xingming18" class="input" id="xingming18" size="15" />
</div></td>
<td><div align="center">
<select class="input" size="1" name="xingbie18" id="xingbie18">
<option value="男">男</option>
<option value="女">女</option>
</select>
</div></td>
<td><div align="center"> <input type="text" class="input" size="5" readonly value="" name="xiaohai18" id="xiaohai18">
</div></td>
<td><div align="center">
<select class="input" size="1" name="zhengjian18" id="zhengjian18">
<option value="身份证">身份证</option>
<option value="户口本">户口本</option>
<option value="出生证">出生证</option>
<option value="港澳通行证">港澳通行证</option>
<option value="护照">护照</option>
<option value="回乡证">回乡证</option>
</select>
</div></td>
<td><div align="center">
<input name="zjhm18" class="input" id="zjhm18" size="25" value="0"/>
</div></td>
<td><div align="center">
<textarea name="kebeizhu18" id="kebeizhu18" cols="28" rows="1" >无</textarea>
</div></td>
</tr>
</table>

</div>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>

<script>
// Last updated 2006-02-21
function addRowToTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);

// left cell
var cellLeft = row.insertCell(0);
var textNode = document.createTextNode(iteration);
cellLeft.appendChild(textNode);

// right cell
var cellRight = row.insertCell(1);
var el = document.createElement('input');
el.type = 'text';
el.name = 'txtRow' + iteration;
el.id = 'txtRow' + iteration;
el.size = 40;

el.onkeypress = keyPressTest;
cellRight.appendChild(el);

// select cell
var cellRightSel = row.insertCell(2);
var sel = document.createElement('select');
////alert(iteration);
sel.name = 'selRow' + iteration;
sel.options[0] = new Option('text zero', 'value0');
sel.options[1] = new Option('text one', 'value1');
cellRightSel.appendChild(sel);

var cellRightSel = row.insertCell(3);
var sel = document.createElement('select');
sel.name = 'selRowd' + iteration;
sel.options[0] = new Option('text zero', 'value0');
sel.options[1] = new Option('text one', 'value1');
cellRightSel.appendChild(sel);
}
function keyPressTest(e, obj)
{
var validateChkb = document.getElementById('chkValidateOnKeyPress');
if (validateChkb.checked) {
var displayObj = document.getElementById('spanOutput');
var key;
if(window.event) {
key = window.event.keyCode;
}
else if(e.which) {
key = e.which;
}
var objId;
if (obj != null) {
objId = obj.id;
} else {
objId = this.id;
}

displayObj.innerHTML = objId + ' : ' + String.fromCharCode(key);
}
}
function removeRowFromTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
function openInNewWindow(frm)
{
// open a blank window
var aWindow = window.open('', 'TableAddRowNewWindow',
'scrollbars=yes,menubar=yes,resizable=yes,toolbar=no,width=400,height=400');

// set the target to the blank window
frm.target = 'TableAddRowNewWindow';

// submit
frm.submit();
}
function validateRow(frm)
{
var chkb = document.getElementById('chkValidate');
if (chkb.checked) {
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length - 1;
var i;
for (i=1; i<=lastRow; i++) {
var aRow = document.getElementById('txtRow' + i);
if (aRow.value.length <= 0) {
alert('Row ' + i + ' is empty');
return;
}
}
}
openInNewWindow(frm);
}

</script>

</head>
<body>
<form id="form1" runat="server" action="Default.aspx" method="get">
<div>
<p>
<input type="button" value="Add" onclick="addRowToTable();" />
<input type="button" value="Remove" onclick="removeRowFromTable();" />
<input type="button" value="Submit" onclick="validateRow(this.form);" />
<input type="checkbox" id="chkValidate" /> Validate Submit
</p>
<p>
<input type="checkbox" id="chkValidateOnKeyPress" checked="checked" /> Display OnKeyPress
<span id="spanOutput" style="border: 1px solid #000; padding: 3px;"> </span>
</p>
<table border="1" id="tblSample">
<tr>
<th colspan="3">Sample table</th>
</tr>
<tr>
<td>1</td>
<td><input type="text" name="txtRow1"
id="txtRow1" size="40" onkeypress="keyPressTest(event, this);" /></td>
<td>
<select name="selRow0">
<option value="value0">text zero</option>
<option value="value1">text one</option>
</select>
</td>
</tr>
</table>

</div>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>code by meixx</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
var curRow=null;
function selectRow(tr1){
if(curRow)
curRow.bgColor="#FFFFFF";
tr1.bgColor="e7e7e7";
curRow=tr1;
}
function addRow(src){
var newrow = src.insertRow(src.rows.length-1);
newrow.attachEvent("onclick",function(){selectRow(newrow);});
newrow.height=20;
var i=4;
while(i--){
var newcell = newrow.insertCell();
switch(i){
case 0: newcell.innerHTML= '<input type="button" onClick="javascript:delRow(this.parentElement.parentElement)" value="删除此行">';break;
default: newcell.innerHTML=div1.innerHTML;break;
}
}
}
function delRow(src){
src.parentElement.deleteRow(src.rowIndex);
}
</script>
</head>

<body>
<table id="tb" width="100%" border="1" align="center" cellpadding="1" cellspacing="1" style="border-collapse:collapse" bordercolor="#111111">
<tr>
<th scope="col" width="25%">一</th>
<th scope="col" width="25%">二</th>
<th scope="col" width="25%">三</th>
<th scope="col" width="25%">四</th>
</tr>
<tr id="blankRow" onClick="addRow(this.parentElement)">
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<div id="div1" style="display:none "><input id="txt" type="text" style="width:97%; background-color:#FFFFEF"></div>


<table id="table1"><tr><td></td><td></td><td></td></tr></table>
<script>
function AddNew(){
var newRow;
var newCell;
newRow = table1.insertRow();
newCell=newRow.insertCell();
newCell.width="164";
newCell=newRow.insertCell();
newCell.innerHTML="<select><option value='0'>0</option></select>"
newCell.width="164";
newCell=newRow.insertCell();
newCell.innerHTML="<select><option value='1'>1</option></select>"
newCell.width="164";
}
AddNew();
</script>


</body>
</html>

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language="javascript">// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
var p, i, foundObj;
if(!theDoc) theDoc = document;
if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
{
theDoc = parent.frames[theObj.substring(p+1)].document;
theObj = theObj.substring(0,p);
}
if(!(foundObj = theDoc[theObj]) && theDoc.all)
foundObj = theDoc.all[theObj];

for (i=0; !foundObj && i < theDoc.forms.length; i++)
foundObj = theDoc.forms[i][theObj];

for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
foundObj = findObj(theObj,theDoc.layers[i].document);

if(!foundObj && document.getElementById)
foundObj = document.getElementById(theObj);

return foundObj;
}
//添加一个参与人填写行
function AddSignRow(){ //读取最后一行的行号,存放在txtTRLastIndex文本框中
var txtTRLastIndex = findObj("txtTRLastIndex",document);
var rowID = parseInt(txtTRLastIndex.value);

var signFrame = findObj("SignFrame",document);
//添加行
var newTR = signFrame.insertRow(signFrame.rows.length);
newTR.id = "SignItem" + rowID;

//添加列:序号
var newNameTD=newTR.insertCell(0);
//添加列内容
newNameTD.innerHTML = newTR.rowIndex.toString();

//添加列:姓名
var newNameTD=newTR.insertCell(1);
//添加列内容
newNameTD.innerHTML = "<input name='txtName" + rowID + "' id='txtName" + rowID + "' type='text' size='12' />";

//添加列:电子邮箱
var newEmailTD=newTR.insertCell(2);
//添加列内容
newEmailTD.innerHTML = "<input name='txtEMail" + rowID + "' id='txtEmail" + rowID + "' type='text' size='20' />";

//添加列:电话
var newTelTD=newTR.insertCell(3);
//添加列内容
newTelTD.innerHTML = "<input name='txtTel" + rowID + "' id='txtTel" + rowID + "' type='text' size='10' />";

//添加列:手机
var newMobileTD=newTR.insertCell(4);
//添加列内容
newMobileTD.innerHTML = "<input name='txtMobile" + rowID + "' id='txtMobile" + rowID + "' type='text' size='12' />";

//添加列:公司名
var newCompanyTD=newTR.insertCell(5);
//添加列内容
newCompanyTD.innerHTML = "<input name='txtCompany" + rowID + "' id='txtCompany" + rowID + "' type='text' size='20' />";


//添加列:删除按钮
var newDeleteTD=newTR.insertCell(6);
//添加列内容
newDeleteTD.innerHTML = "<div align='center' style='width:40px'><a href='javascript:;' onclick=\"DeleteSignRow('SignItem" + rowID + "')\">删除</a></div>";

//将行号推进下一行
txtTRLastIndex.value = (rowID + 1).toString() ;
}
//删除指定行
function DeleteSignRow(rowid){
var signFrame = findObj("SignFrame",document);
var signItem = findObj(rowid,document);

//获取将要删除的行的Index
var rowIndex = signItem.rowIndex;

//删除指定Index的行
signFrame.deleteRow(rowIndex);

//重新排列序号,如果没有序号,这一步省略
for(i=rowIndex;i<signFrame.rows.length;i++){
signFrame.rows[i].cells[0].innerHTML = i.toString();
}
}//清空列表
function ClearAllSign(){
if(confirm('确定要清空所有参与人吗?')){
var signFrame = findObj("SignFrame",document);
var rowscount = signFrame.rows.length;

//循环删除行,从最后一行往前删除
for(i=rowscount - 1;i > 0; i--){
signFrame.deleteRow(i);
}

//重置最后行号为1
var txtTRLastIndex = findObj("txtTRLastIndex",document);
txtTRLastIndex.value = "1";

//预添加一行
AddSignRow();
}
}
</script>
</HEAD>

<BODY>
<div>
<table width="613" border="0" cellpadding="2" cellspacing="1" id="SignFrame">
<tr id="trHeader">
<td width="27" bgcolor="#96E0E2">序号</td>
<td width="64" bgcolor="#96E0E2">用户姓名</td>
<td width="98" bgcolor="#96E0E2">电子邮箱</td>
<td width="92" bgcolor="#96E0E2">固定电话</td>
<td width="86" bgcolor="#96E0E2">移动手机</td>
<td width="153" bgcolor="#96E0E2">公司名称</td>
<td width="57" align="center" bgcolor="#96E0E2">&nbsp;</td>
</tr>
</table>
</div>
<div>
<input type="button" name="Submit" value="添加参与人" onclick="AddSignRow()" />
<input type="button" name="Submit2" value="清空" onclick="ClearAllSign()" />
<input name='txtTRLastIndex' type='hidden' id='txtTRLastIndex' value="1" />
</div>

</BODY>
</HTML>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head></head>

<script language="javascript">
function add()
{
var myTable = document.getElementById("aa");
var newRow = aa.insertRow(aa.rows.length);
var newTd1 = newRow.insertCell(0);
newTd1.innerText="lala";
var newTd2 = newRow.insertCell(1);
newTd2.innerText="^_^";
}
</script>
<body>
<form>
<input type="button" onclick="addline()" value="增加一行">
<table border="1" id="test">
<tr>
<td colspan="2"><input type="text" name="tt[]"></td>
</tr>
</table>
<input type="submit">
</form>
<script>
function addline(content){
newline=document.all.test.insertRow();
newline.insertCell().innerHTML='<input type="text" name="tt[]"><input type="button" value="删除此行" onclick="del()">'

}
function del(){
document.all.test.deleteRow(window.event.srcElement.parentElement.parentElement.rowIndex);
}
</script>
<input type="button" value="点我啊" onclick="add();">
<table id="aa" border="1" bordercolor="black" style="border-collapse: collapse" width="80%">
<tr>
<td width="50%">xixi</td>
<td width="50%">haha</td>
</tr>
</table>

</body>
</html>

re: asp.net 调用js事件,示例 温景良(Jason) 2009-05-12 23:14  
up
re: 面试六十家公司的深圳体验(转贴) 小隐没登陆 2009-05-01 21:22  
这样都没有人顶,实在是太可惜了
re: 【经典】jQuery使用大全 温景良(Jason) 2009-05-01 00:32  
学习
re: Js 实现消息来时让网页标题闪动 温景良(Jason) 2009-05-01 00:03  
收藏
re: C#自动登录DiscuzNT论坛并发帖 Tiger.liang 2009-03-16 17:18  
我用了一下,可以啊。。。
会不会与网站有关系啊,

会不会有的网站做了一些调整??
恩,虽然我没看倒什么?但是我感觉已经够了 ~ 谢谢搂住
第1个类的“增加提交的值”方法中:

命名空间“System.Web”中不存在类型或命名空间名称“HttpUtility”

请问怎么处理啊?
re: 写入和读取cookie数组? oec2003 2009-01-17 10:41  
挺详细
发给我一份吧谢谢
zhaojichengreal@gmail.com
我做的是C/S的 应用。按下面得不到证书内容

private void button2_Click(object sender, EventArgs e)
{

ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy();


string postData = @"CREDITID=CDB992362323";
Encoding encoding = Encoding.GetEncoding("gb2312");
string strUrl = "https://www.server.com/asdfjlsdf.jsp";
byte[] data = encoding.GetBytes(postData);
//准备请求
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(strUrl);
myRequest.ClientCertificates.Add(new Class1()[0]); //证书可以遍历出来让客户选择,但我这里是测试程序,直接就选择我需要的那个了。
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
myRequest.KeepAlive = true;

Stream newStream = myRequest.GetRequestStream();
//发送数据
newStream.Write(data, 0, data.Length);
newStream.Close();

//读取回来的数据
HttpWebResponse res = (HttpWebResponse)myRequest.GetResponse();
StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.Default);
textBox1.Text = sr.ReadToEnd();
sr.Close();
res.Close();


}
您好。。。刚好碰到类似的问题。

好不容易找到你的blog。。。

请问下
在_Default 页面并没有实例Class1,赋值。怎么可以直接使用
myRequest.ClientCertificates.Add(s[0]);

非常感谢!找这个工具找的好辛苦啊!
我的邮箱englishine@126.com
re: C#自动登录DiscuzNT论坛并发帖 水长 2008-12-11 18:10  
非常需要这样的代码,急盼楼主发份代码给我,用了上面的代码登录成功了,发帖有问题啊!
找了很久了,发个链接过来吧,先谢了
找了好久 而且试了那么多 这个代码才实用点!! thanks
谢谢,请发给我一份chuqi26@gmail.com
我也想要全功能免费版
也请发给全功能免费版我吧,邮箱
airboat97@qq.com
发给全功能免费版我吧,邮箱mangohappy@qq.com
re: 繁體字 互转换 简体字 未知未来 2008-09-05 08:55  
re: 繁體字 互转换 简体字 未知未来 2008-09-05 08:54  
广泛个不
接收邮件的能贴出来吗
MSN :aminta_childhood@hotmail.com
EMAIL: aminta_childhood@hotmail.com
现在很多网站登陆都要验证码

有了这个方法,不知道能不能跟httpwebrequest结合起来,实现在WebBrowser中登陆一次,进而使httpwebrequest通过身份验证,疯狂的抓取数据呢?如果可以就太爽了,明天我试一下 ^_^
HTMLInputElementClass 在哪个namespace下面,谢谢
共2页: 1 2 下一页