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]
...全文
174 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
特别提示:本代码至少需百度应用引擎(BAE)中的百度云存储(BCS)支持 Licensed under the Apache License v2.0 http://www.apache.org/licenses/LICENSE-2.0 config.php 填写BAE数据库名称 通过平台提供的PhpMyAdmin访问 导入baefile.sql 不支持URL Rewrite请将no-rewrite-list.php重命名为list.php 只有list.php有写css样式表 本地或其它空间大文件上传,修改php.ini 如: post_max_size = 320M upload_max_filesize = 320M max_execution_time = 300 max_input_time = 600 memory_limit = 512M 特别说明: 使用非BAE环境请将localhost-config.php重命名为config.php、配置数据库及百度云存储相关 1、请自行修改config.php里的配置 ①请将 sql_db_name 改为你的数据库名字 关于如何查看自己的数据库名,可在BAE后台点击各项菜单,切换到相应的页面查看数据库名。或者在登录BAE的状态下直接打开这个网址:http://developer.baidu.com/bae/bdbs/db ②请在 $ak $sk 填写你的密匙对。关于查看自己的密匙对(如果没有则请创建),请在登录BAE的状态下打开 http://developer.baidu.com/bae/ref/key 2、请在BAE后台手动创建一个bucket http://developer.baidu.com/bae/bcs/bucket 请注意自行修改config.php里的$bucket 附: nginx的URL Rewrite规则,请将下面规则加入到站点配置中,重启nginx即可 rewrite ^/page-([0-9]+)/?$ /index.php?page=$1 last; rewrite ^/del-list-([0-9]+)$/?$ /del-list.php?page=$1 last;

110,021

社区成员

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

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

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