Re: Silverlight client IP address and/or host name

Re: Silverlight client IP address and/or host name

Old forum URL: forums.lhotka.net/forums/t/10002.aspx


tmg4340 posted on Saturday, January 29, 2011

I presume you're using the WCF DataPortal?  WCF doesn't automatically hook into the ASP.NET process, so no HttpContext is available.

Check out the AspNetCompatibilityRequirementsAttribute object.  You can decorate your service with this attribute and set the RequirementsMode property so that WCF will hook into the ASP.NET process, and then HttpContext.Current will be populated.  Typically in your situation, developers set it like this:

[AspNetCompatibilityRequirements(RequirementsMode=Required)]

HTH

- Scott

Copyright (c) Marimer LLC