Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems Creating a file
Message
From
14/01/2011 05:10:09
 
 
To
13/01/2011 17:38:04
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01496043
Message ID:
01496129
Views:
32
>>>>>>>I've verified the URL is correct by displaying it on the form and copying it to a new web page and running it. I did get asked to login by the Report Server, maybe that's the forbidden part?
>>>>>>
>>>>>>Most likely. Perhaps the System.Net.CredentialCache.DefaultCredentials on the clients machine would not have been a valid login?
>>>>>
>>>>>Hmm, should i change it to DefaultNetworkCredentials? Or do I do this differently?
>>>>
>>>>I guess I'd look at the properties of the credentials used on your development machine and, since that is working, create and use the same credentials on the clients server. Of course I could be wrong - just saying what I'd try......
>>>
>>>I think I need to understand the code a bit more.
>>>
>>>Have I understood what these lines of code actually do?
>>>
>>>
// Create a HttpWeb Request object referring to the desired URL
>>>System.Net.HttpWebRequest Req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(URL);
>>>// Set the security credentials to be used by the httpwebrequest
>>>Req.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
>>>// Specify that we will call the Get method
>>>Req.Method = "GET";
>>>// Actually "run" the URL and get the response back.
>>>System.Net.WebResponse objResponse = Req.GetResponse();
>>>
>>
>>AFAIK, Yes.
>>
>>>If I comment out the credentials then I get a (401) Unauthorized error on my PC. Which is different to the 403 error I'm getting at the client.
>>
>>401 is 'Unauthorised' so either no credentials were sent or, if they were, they were invalid.
>>403 is 'Forbidden' . But I don't know why you'd get in this case.
>>
>>>How do I look at the properties of the credentials on my machine?
>>Debugger :-} But if your getting a 401 then presumably they aren't going to work anyway ?
>>
>>>Thanks for all your help.
>>Best hold off on that until you actually solve the problem :-}
>
>:) Just thanking you for spending the time so far (got to keep you encouraged so you won't abandon me) :)
>
>In the debugger, when I set the credentials and check what they are, everything is blank. What I meant was what exactly am I supposed to look at/for in the debugger? I see the base and Static Members. base shows me Domain, Username and Password all are the empty string. Static Members seems to take me right back to the base stuff.

Ah, from help :The ICredentials instance returned by DefaultCredentials cannot be used to view the user name, password, or domain of the current security context.

TBH I'm not au fait with all of the CredentialCache stuff. If I were you I'd try creating your own credentials and using that:
Req.Credentials = new NetworkCredential("UserName", "password"); // or other relevant constructor
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform