url rewrite的页面如何post?

xiaofei0804 2008-07-07 06:53:24
action的真实地址被改写了,直接post的话,返回的还是登录的页面,值传不上去,高手帮忙看下

ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "username=xiaofei0804&password=19840804";
byte[] data = Encoding.GetEncoding("GB2312").GetBytes(postData);
CookieContainer ccc = new CookieContainer();
// Prepare web request
HttpWebRequest myRequest =
(HttpWebRequest)WebRequest.Create("http://www.gxhouse.com/2sf/User_Login.aspx");

myRequest.Method = "POST";
myRequest.CookieContainer = ccc;
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();

// Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close();

// Get response
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.Default);
string content = reader.ReadToEnd();
[/align]
...全文
178 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaofei0804 2008-07-08
  • 打赏
  • 举报
回复
2楼你可能误解我意思了,我是想向页面post信息,但是找不到表单提交的地址,不是要url rewrite.我觉得不是cookies的问题,比如有些网站,它表单action的地址是一个“www.xxx.html”,html怎么处理登录事件?所以post肯定失败。
wenbin 2008-07-07
  • 打赏
  • 举报
回复
很有可能是Cookies的问题
去找个HttpWatch看看
jzywh 2008-07-07
  • 打赏
  • 举报
回复
http://www.cnblogs.com/jzywh/archive/2007/12/20/urlrewriteaction.html

110,825

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧