Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass identity from Form to WebService ?
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01024385
Message ID:
01026129
Views:
19
Hi Viv,

This works:
private void Page_Load(object sender, System.EventArgs e)
{

Westwind.InternetTools.wwHttp Http = new wwHttp();
Http.CreateWebRequestObject("http://www.west-wind.com/wwstore/admin/default.aspx");

// *** This picks up the current login 
Http.WebRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;

string Result = Http.GetUrl("http://www.west-wind.com/wwstore/admin/default.aspx");

Response.Write("System Username:" + Environment.UserName);
Response.Write("Auth Username: " + User.Identity.Name);

if (Http.Error)
	Response.Write("ERROR: " + Http.ErrorMessage);
else
	Response.Write(Result);	

Response.End();
}
where the url I'm hitting is protected by Windows Authentication.

My security on the client page (and on the server as well in the admin directory) is set up like this:
<location path="demos">
<system.web>
    <identity impersonate="true" />
    <!-- WS: Allow only Authenticated users -->
    <authorization>
    <!-- allow users="*" /-->
    <deny users="?" />
    </authorization>
</system.web>
</location>
With the Config file you don't even need to set any directory permissions, unless you also need to protect files not handled by ASP.NET.

+++ Rick --


\
>Hi,
>
>>>
>Here's what I've found so far:
>
>I created a small Web Service project using the standard "Hello World" Example method.
>
>Under the IIS Console Mgr I left Authorization and Authentication as is.
>
>I right-clicked specifically on the asmx file that had the "Hello World" method and set the file security to Windows Authentication ONLY.
>
>I then created another project with a single page aspx that created System.Net.NetworkCreditial(User, Pass, Domain)
>
>I then set the WebService.Creditials property member to the Network Creditial Object
>
>and viola! It worked.
>>>
>
>But you're just setting the credentials for the web service to a known identity (and in that situation the IIS Security settings are irrelevant).
>
>What I'm trying to do is use the Identity passed to the web page by IIS (System.Threading.Thread.CurrentPrincipal ? ) to set the credentials for the WS proxy.
>
>Regards,
>Viv
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform