Re: How to detect if my component is being called from ASP.NET application?
From: John Lee (johnl_at_newsgroup.nospam)
Date: 01/11/05
- Next message: David Levine: "Re: How to kill a thread in c#?"
- Previous message: Pankajdynamic: "Issue with NLB Manager - Cluster's IP address"
- In reply to: John Lee: "How to detect if my component is being called from ASP.NET application?"
- Next in thread: Kevin Yu [MSFT]: "Re: How to detect if my component is being called from ASP.NET application?"
- Reply: Kevin Yu [MSFT]: "Re: How to detect if my component is being called from ASP.NET application?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 11 Jan 2005 15:55:20 -0800
I tried the following code -
if (System.Web.HttpContext.Current != null)
{
//invoked by ASP.NET app
}
else
{
//windows app
}
Is above solution 100% reliable?
Thanks!
John
"John Lee" <johnl@newsgroup.nospam> wrote in message
news:OOWOARD%23EHA.2196@TK2MSFTNGP14.phx.gbl...
> Hi,
>
> I have a component with some static public methods and is it possible from
> inside my method to decide if my component is invoked by an ASP.NET
> application (such as web service) or a windows application? If YES, How to
> do that?
>
> If I know it's invoked by web service (web service is configured as
> windows authentication only and assigned an application pool with NT
> domain account as identity), Is the following assumption is 100% correct?
> or what is the most reliable way of getting the authenticated user's name
> and the service account's name?
>
> 1. Authenticated user will be
> System.Threading.Thread.CurrentPrincipal.Identity.Name
> 2. Service account will be WindowsIdentity.GetCurrent().Name
>
> If it's invoked by windows app, the authenticated user will be
> WindowsIdentity.GetCurrent().Name, is this valid and reliable assumption?
>
> Thanks a lot!
> John
>
>
- Next message: David Levine: "Re: How to kill a thread in c#?"
- Previous message: Pankajdynamic: "Issue with NLB Manager - Cluster's IP address"
- In reply to: John Lee: "How to detect if my component is being called from ASP.NET application?"
- Next in thread: Kevin Yu [MSFT]: "Re: How to detect if my component is being called from ASP.NET application?"
- Reply: Kevin Yu [MSFT]: "Re: How to detect if my component is being called from ASP.NET application?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|