Autor Beitrag
mokus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 36

Win 7 Pro.
C#, VS 2010
BeitragVerfasst: Mi 23.06.10 22:54 
Hallo,
ich hätt da mal eine frage und zwar hab ich eine Sivlerlight-Anwendung, diese soll den Inhalt einer Textdatei abrufen können.

ausblenden C#-Quelltext
1:
2:
WebClient _webClient = new WebClient();
_webClient.DownloadStringAsync(new Uri("http://www.#######.de/########.txt", UriKind.Absolute));


Jetzt habe ich aber das Problem, das ich die ganze Zeit eine Sicherheitsfehlermeldung bekomme. Die URL ist zu 100% richtig und die Anwendung führe ich lokal auf meinem Rechner aus.

Fehlermeldung:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
{System.Reflection.TargetInvocationException: Während des Vorgangs ist eine Ausnahme aufgetreten, sodass das Ergebnis ungültig ist. Weitere Ausnahmedetails finden Sie in InnerException. ---> System.Security.SecurityException ---> System.Security.SecurityException: Sicherheitsfehler
   bei System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   bei System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
   bei System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   bei System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   bei System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
   bei System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
   bei System.Net.DownloadStringCompletedEventArgs.get_Result()}


Was kann das sein, bei google hab ich bis jetzt nichts gefunden?
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Do 24.06.10 12:42 
Eine Policy-Datei existiert aber?
Zitat:
Silverlight version 2 and later have support for cross-domain connectivity which allows an application to access resources from locations other than the site of origin. This is an important feature for enabling Silverlight applications to consume existing services on the web. The security policy system in the Silverlight runtime requires that a policy file be downloaded from a network resource before a network connection is allowed access to that resource. This security policy system affects cross-domain network access for WebClient and HTTP classes in the System.Net namespace. Network connections for WebClient and HTTP classes to the site or host of origin do not require a security policy. For more information, see Network Security Access Restrictions in Silverlight.

_________________
>λ=
mokus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 36

Win 7 Pro.
C#, VS 2010
BeitragVerfasst: Do 24.06.10 12:54 
Ich glaub da ist das Problem, wo sollte ich diese anlegen, in das Projekt und wenn wie binde ich sie dort ein?
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Do 24.06.10 19:48 
Am besten klickst du dafür auf den verlinkten Artikel.

_________________
>λ=
mokus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 36

Win 7 Pro.
C#, VS 2010
BeitragVerfasst: Fr 25.06.10 11:53 
Okay das Runterladen funktioniert jetzt einwandfrei. Jetzt hab ich aber das Problem, dass wenn ich die Datei auf dem Server ändere, die änderrungen nicht übernommen werden beim Abfragen. Also das der WebClient immer noch die alte Datei abruft, wobei die auf dem Server anderen Inhalt hat.

Das Problem hat sich erledigt, die Seite wird ja im Cache des Browsers gespeichert und habe dafür einfach eine zahlenkombinioation oder GUID die bei jedem abfragen anders ist, über Get übergeben.