HttpWebRequest /响应电子邮件附件 [英] HttpWebRequest/Response with e-mail attachments
问题描述
Clear DayHello,
我已经在.NET中实现了一个覆盖Internet的下载管理器
Explorer'的bult-in下载管理器。 />
我使用HttpWebRequest / Response下载文件。
除非我尝试从
$ b $下载附件文件,否则一切正常b。基于网络的邮箱。
我尝试过使用凭证并保存cookie,没有任何帮助。
请尝试帮助我在这件事上。
Tomer。
Clear DayHello,
I have implemented a download manger in .NET that overrides Internet
Explorer''s bult-in download manager.
I using HttpWebRequest/Response to download the files.
All is working well except when I try to download an attachment file from a
web-based mailbox.
I''ve tried using credentials and saving the cookies, nothing helps.
Please try and assist me in this matter.
Tomer.
推荐答案
tomer写道:
Clear DayHello,
我已经在.NET中实现了一个下载管理器,它可以覆盖Internet
Explorer'的bult-in下载管理器。
我使用HttpWebRequest / Response下载文件。
除非我尝试从基于Web的邮箱下载附件文件,否则一切正常。
我尝试过使用凭据并保存c ookies,没有什么帮助。
Clear DayHello,
I have implemented a download manger in .NET that overrides Internet
Explorer''s bult-in download manager.
I using HttpWebRequest/Response to download the files.
All is working well except when I try to download an attachment file
from a web-based mailbox.
I''ve tried using credentials and saving the cookies, nothing helps.
好吧,发布一些代码并更详细地描述问题...
干杯,
-
Joerg Jooss
jo ********* @ gmx.net
好吧,
网址解决是这样的:
http://some.domain.com/?w=/@attach&f...=Brusselse.wmv
HttpWebRequest请求;
request =(HttpWebRequest)HttpWebRequest.Create(url);
request.AllowAutoRedirect = false;
request.Method =" GET";
CredentialCache wrCache = new CredentialCache();
wrCache.Add(new Uri(url)," Basic",new NetworkCredential(username,password));
request.Credenti als = wrCache;
HttpWebResponse response =(HttpWebResponse)request.GetResponse();
string newurl = GetRedirectURL(response); //它通过一个
重定向,这个函数获取新的URL
比我再次做请求/响应使用新网址,并最终下载HTML
域中某个未知页面的页面源代码。 (也许是登录页面。)
" Joerg Jooss" <乔********* @ gmx.net>在消息中写道
新闻:uJ ************* @ TK2MSFTNGP12.phx.gbl ...
Well,
The URL to resolve is something like this:
http://some.domain.com/?w=/@attach&f...=Brusselse.wmv
HttpWebRequest request;
request = (HttpWebRequest)HttpWebRequest.Create(url);
request.AllowAutoRedirect=false;
request.Method = "GET";
CredentialCache wrCache = new CredentialCache();
wrCache.Add(new Uri(url),"Basic",new NetworkCredential(username,password));
request.Credentials = wrCache;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string newurl = GetRedirectURL(response); // it goes trough one
redirection, this function gets the new URL
Than I again do "request/response" with new url, and end up downloading HTML
page source code of some unknown page in the domain. (Maybe the logon page).
"Joerg Jooss" <jo*********@gmx.net> wrote in message
news:uJ*************@TK2MSFTNGP12.phx.gbl...
tomer写道:
Clear DayHello,
我已经在.NET中实现了一个下载管理器,它可以覆盖Internet
Explorer'的bult-in下载管理器。
我使用HttpWebRequest / Response下载文件。
除了我尝试从基于网络的邮箱下载附件文件外,一切正常。
我已经尝试使用凭据并保存cookie,没有任何帮助。
Clear DayHello,
I have implemented a download manger in .NET that overrides Internet
Explorer''s bult-in download manager.
I using HttpWebRequest/Response to download the files.
All is working well except when I try to download an attachment file
from a web-based mailbox.
I''ve tried using credentials and saving the cookies, nothing helps.
好吧,发布一些代码并更详细地描述问题...
干杯,
jo ******** *@gmx.net
tomer写道:
嗯,
要解决的URL是这样的:
http://some.domain.com/?w=/@attach&f...= Brusselse.wmv
HttpWebRequest请求;
request =(HttpWebRequest)HttpWebRequest.Create(url);
request.AllowAutoRedirect =假;
出于好奇:为什么需要实施自己的重定向处理?
request.Method =" GET";
CredentialCache wrCache = new CredentialCache();
wrCache.Add(new Uri(url)," Basic",new
NetworkCredential(username,password));
request.Credentials = wrCache;
HttpWebResponse response =(HttpWebResponse)request.GetResponse();
string newurl = GetRedirectURL(response); //它通过一个
重定向,这个函数获取新的URL
Well,
The URL to resolve is something like this:
http://some.domain.com/?w=/@attach&f...=Brusselse.wmv
HttpWebRequest request;
request = (HttpWebRequest)HttpWebRequest.Create(url);
request.AllowAutoRedirect=false;
Out of curiosity: Why do need to implement your own redirection handling?
request.Method = "GET";
CredentialCache wrCache = new CredentialCache();
wrCache.Add(new Uri(url),"Basic",new
NetworkCredential(username,password));
request.Credentials = wrCache;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string newurl = GetRedirectURL(response); // it goes trough one
redirection, this function gets the new URL
但是到目前为止究竟发生了什么?你确定你没有丢失你的
凭证或会话cookie吗?
干杯,
-
Joerg Jooss
jo ********* @ gmx.net
But what exactly happens at this point? Are you sure you''re not losing your
credentials or a session cookie?
Cheers,
--
Joerg Jooss
jo*********@gmx.net
这篇关于HttpWebRequest /响应电子邮件附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!