473,809 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OperationContex t.Current or HttpContext.Cur rent in MembershipProvi der within WCF Service = null?

I have a custom membership provider that I am using to authenticate
users in a WCF web service hosted IIS. I want to be able to see any
cookies that come across and save session variables, but I cannot get
to the OperationContex t.Current nor the HttpContext.Cur rent (I am
using aspNetCompatibi lity=true and confirmed that it is enabled in the
debugger) - both are null. Is there a setting someplace that will
enable these to be available to the MembershipProvi der? When I get
into the service they are available, but not before. Is there an
alternative way to get to cookie and session data in WCF?

May 17 '07 #1
4 10716
WCF deliberately divorces itself from the transport, as WCF must work
equally with HTTP, TCP, MSMQ, carrier-pidgeon, etc.

What specifically are you looking to do? For custom authentication,
see below; for other operations, "inspectors " are often the way to
go...

You might also find the
microsoft.publi c.windows.devel oper.winfx.indi go group more apt.

http://groups.google.co.uk/group/mic...40905d321cce17

Marc

May 17 '07 #2
microsoft.publi c.windows.devel oper.winfx.indi go group
Oops! my bad... my aggregator confused me... I thought this was
somewhere else ;-p

Marc

May 17 '07 #3
(ahh... multipost... don't do that ;-p)

May 17 '07 #4
On May 17, 4:44 pm, Marc Gravell <marc.grav...@g mail.comwrote:
WCF deliberately divorces itself from the transport, as WCF must work
equally with HTTP, TCP, MSMQ, carrier-pidgeon, etc.

What specifically are you looking to do? For custom authentication,
see below; for other operations, "inspectors " are often the way to
go...

You might also find the
microsoft.publi c.windows.devel oper.winfx.indi go group more apt.

http://groups.google.co.uk/group/mic...ws.developer.w...

Marc
I need to pass in a third-party session id, along with the username
and password that is used for authentication for a WCF service that is
hosted in IIS. I was hoping to use a cookie to return the session id
to the client and have them resubmit it on each request. I am using a
custom membership provider to implement the custom authentication
logic. I use this membership provider for web apps also so it has to
be ASP.NET compatible. When I use the attribute to make WCF ASP.NET
compatible I see neither the HttpContext nor the
OperationContex t.Current objects. These appear to not be instantiated
until I get past the authentication process in WCF - in plain asp.net
this works fine. Can anyone confirm that this is normal behavior for
WCF? Also, is there a way that cookie data gets mapped to objects in
WCF? Lastly, other than using custom tokens or explicit parameters,
are there any other recommended approaches to passing in data to be
used in the preprocessing of a WCF service request?

May 18 '07 #5

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

Similar topics

2
3054
by: Jesper Stocholm | last post by:
I have implemented role-based security within my ASP.Net application. However, it seems the role is not passed to the authentication ticket I create. I want to use it to display/hide some content based on the user's role. I wrote this to do it: if (HttpContext.Current.User.Identity.IsAuthenticated) { plLoggedIn.Visible = true;
2
3347
by: moondaddy | last post by:
I need to set a variable to a session variable (if that's what you call it) like this: dim ds as dataset = HttpContext.Current.Session("CustDataSet") But I get an exception if this variable in the current session hasn't been set yet so I need to test it. I tried: If HttpContext.Current.Session("CustDataSet") = nothing then HttpContext.Current.Session("CustDataSet") = GetCustDataSet()
2
2155
by: | last post by:
Today I learned that creating cookies inside of a custom class in ASP.NET 2.0 requires that you prefix it with HttpContext.Current..., e.g. : HttpContext.Current.Response.Cookies.Add("myNewCookie"); I am wondering if there are any landmines that I should know about, or if this will work pretty much as I am expecting a cookie should.
1
4320
by: Dave | last post by:
I'm trying call a couple WebRequests asynchronously using the QueueUserWorkItem, but one thing I noticed is that the HttpContext is null within the asynchronous call. I was using HttpContext.Current.Server.MapPath to load an Xslt file to format and return Xml after the webrequest is made. Is there a way around this? Here some code... stateInfo = new StateInfo(manualEvents, strUrl);
0
5409
by: Aaron Morton | last post by:
I'm working on a IHttpModule that handles the PreSendRequestHeaders event from the HttpApplication, if the event is raised after EndRequest then HttpContext.Current is null. If it is raised before EndRequest (by turning response buffering off) then HttpContext.Current is set. To repo add the following to Global.asax protected void Application_PreSendRequestHeaders(object sender, EventArgs e) {...
0
1761
by: sandrofurlan | last post by:
Hi all, i have a WCF service for USB communication. I need to instance it as a singleton class so i do: <ServiceBehavior(InstanceContextMode:=InstanceContextMode.Single, _ ConcurrencyMode:=ConcurrencyMode.Multiple)_ Public Class myService ....
8
996
by: eric | last post by:
I have a 2.0 asp.net project. In a class contained within a seperate project, I am trying to reference HttpContext.Current.Session but Session is always null. I've tried implementing IRequiresSessionState but it does not seem to matter. For a test I created a small solution consisting of a web project and a seperate project to hold a test class. In the test class I reference HttpContext.Current.Session and it works fine with or without...
3
8913
by: Madhur | last post by:
Hello I am delivering an asp.net 2.0 application to my customer. I need to know, If I need to check for the condition of HttpContext.Current to be null in my business logic. I have extensively used Cache and Session objects, and currently I assume HttpContext.Current object to be existent. Also, since I do not have this check, some of my unit test cases fail because there is no HttpContext for them.
5
3576
by: Rory Becker | last post by:
Having now created a Custom MembershipProvider that seems to work correctly with my Logon and ChangePassword controls, I am, as they say, a happy bunny. The next stange is to move on to the creation of content which adjusts based on the user. I have several pages which require a user to be logged on and several which do not. Prior to this point in time I have used 2 different master pages. one with a control which checks a session...
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10379
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10115
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7660
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
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 we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.