Hallo,
ich bekome immer die Fehlermeldung:
Der Remoteserver hat einen Fehler zurückgegeben: (403) Unzulässig.
Bedeutet diese Fehlermeldung das ich keine Zugriffsrechte habe ?
Ich kann mich ganz normal auf dem Server Manuel anmelden.
Es ist Absicht das keine URL's angegeben sind.
Wie kann man das Problem Lösen ???
Vielen dank
C#-Codetag eingefügt. ~Trade
ich bekome immer die Fehlermeldung:
Der Remoteserver hat einen Fehler zurückgegeben: (403) Unzulässig.
Bedeutet diese Fehlermeldung das ich keine Zugriffsrechte habe ?
Ich kann mich ganz normal auf dem Server Manuel anmelden.
Es ist Absicht das keine URL's angegeben sind.
Wie kann man das Problem Lösen ???
C#-Quellcode
- public class CookiesAwareWebClient : WebClient
- {
- public CookieContainer CookieContainer;
- public CookieContainer MyProperty
- {
- get { return CookieContainer; }
- set { CookieContainer = value; }
- }
- public CookiesAwareWebClient()
- {
- CookieContainer = new CookieContainer();
- }
- protected override WebRequest GetWebRequest(Uri address)
- {
- WebRequest request = base.GetWebRequest(address);
- ((HttpWebRequest)request).CookieContainer = CookieContainer;
- return request;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Download("XXXX","XXXX","C:/","https:......");
- Console.ReadLine();
- }
- private static void Download(string benutzerName, string password, string destination, string downloadUri)
- {
- using (CookiesAwareWebClient client = new CookiesAwareWebClient())
- {
- NameValueCollection values = new NameValueCollection();
- values.Add("User name", benutzerName);
- values.Add("Password", password);
- // We authenticate first
- client.UploadValues("https:", values);
- // Now we can download
- string modifieduri = "http:/" + downloadUri.Replace("http:/", "") + "&rp=";
- string filename = System.IO.Path.GetFileName(downloadUri);
- string filepathname = System.IO.Path.Combine(destination, filename);
- client.DownloadFile(modifieduri, filepathname);
- }
- }
- }
Vielen dank
C#-Codetag eingefügt. ~Trade
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Trade“ ()