1
我需要以编程方式将数据发布到表单,但表单的字段保存在php会话中。我使用C#将数据发布到表单,但由于上述问题,它将我重定向到同一页面。在c#中创建会话以发布数据形式
我需要以编程方式将数据发布到表单,但表单的字段保存在php会话中。我使用C#将数据发布到表单,但由于上述问题,它将我重定向到同一页面。在c#中创建会话以发布数据形式
奇怪的巧合。我有类似的东西...
class CookieAwareWebClient : WebClient
{
public CookieContainer Cookies { get; private set; }
public CookieAwareWebClient()
{
Cookies = new CookieContainer();
}
protected override WebRequest GetWebRequest(Uri address)
{
var request = base.GetWebRequest(address) as HttpWebRequest;
if (request != null)
{
request.CookieContainer = Cookies;
return request;
}
return null;
}
}
你的问题非常含糊。您需要CookieContainer
。
告诉你来自[这个问题](http://stackoverflow.com/questions/7737786/programatically-send-a-form-with-post/7737843 #comment9417288_7737843)在SO上。 – Marco
是的,我愿意。我意识到为什么它不起作用的问题 – michelle
请@michelle告诉我们,让我们可以学习一些东西,让其他用户在遇到同样的问题时找到解决方案。 – Marco