473,473 Members | 1,563 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to authenticate when it isn't DefaultCredentials?

I am trying to write a console app that connects to an instance of
Reporting Services' ReportServer service. I'm using custom
authentication (based on FormsAuthentication) rather than Windows
authentication. The usual incantation for connecting to the service is
via code like this:

ReportingService reportingService = new ReportingService();
reportingService.Credentials = CredentialCache.DefaultCredentials;

This will not work because my default credentials will be my Windows
identity, and I need to instead authenticate as a user in our database's
list of users. I expected to be able to do this using NetworkCredential:

reportingService.Credentials = new NetworkCredential(...);

But every time instead I get back is the 302 redirect response
(redirecting to the LogInForm.aspx page). The response isn't even in
the form of a Soap error response.

I have the same problem with the plain-HTTP approach; I have even tried
the following longer variation on the above:

Uri uri = new Uri(servUri, "?%2F&rs:Command=ListChildren");
HttpWebRequest req = (HttpWebRequest) WebRequest.Create(uri);
NetworkCredential cred = new NetworkCredential(...);
CredentialCache cache = new CredentialCache();
cache.Add(servUri, "Basic", cred);
cache.Add(servUri, "NTLM", cred);
cache.Add(servUri, "Digest", cred);
cache.Add(servUri, "Kerberos", cred);
req.Credentials = cache;

I still get the redirect to the log-in page. In this case I think I can
work around this little difficulty, by doing two requests, one to the
log-in page to collect a cookie, and the second to the page I want,
using that cookie. But even if that works, it will not help with the
Soap version (unless I decide I want to do all the Soap requests 'by
hand' via HttpWebRequest).

I have a feeling the problem is that the Credentials thingummy is only
good for kosher HTTP authentication, and that since Forms Authentication
uses cookies, it does not count. Maybe I could switch to using Digest
authentication?
Nov 23 '05 #1
0 2098

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: mike | last post by:
Hello. I have a web site that is using Basic Authentication (yes, I am using HTTPS) and is sessionless (I am maintaining session state in a database via a custom component). When the user...
3
by: Peter Lapic | last post by:
I am running an VB.Net app which calls an ASP.Net Web Service and this service accesses SQL Server. The Web Service & SQL Server run on separate Windows 2000 server on the same domain. As we...
0
by: Kevin L | last post by:
I am trying to use HTTPWebRequest from my application, but I cannot seem to authenticate with my proxy server. My GetResponse statement fails with an Error 407, "Proxy Authentication Required"....
1
by: Marco | last post by:
Hi All, this is the scenario: - "Hello World" web service on Machine A - winform client on Machine B - asp.net webform client on Machine B Everything is Windows Server 2003 on the same...
13
by: ALI-R | last post by:
I know how to authenticate to a webservice using either of these ways(Assuming that rService represents the webservice): 1) rService.Credentials = new...
0
by: Codecommando | last post by:
Hi, I have a .Net 2.0 web service that is set for Windows authentication. Now, in my APS.Net 1.1 app, I am trying to connect to the service. I am using myService.Credentials =...
0
by: gujarsachin2001 | last post by:
hello friends i m connecting to http or https url programatically through console application using follwoing methods of credentilas but if there is username & password for that url through this...
1
by: gujarsachin2001 | last post by:
hello friends i m connecting to http or https url programatically through console application using follwoing methods of credentilas but if there is username & password for that url through this...
0
sing4you
by: sing4you | last post by:
We have a web-based application where we authenticate users. Users get to the reports via links in the application. No one is sent directly to the Report Manager. We have tried Windows...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.