I'm implementing WCF in my Xamarin Forms project, but everytime I try to access the WCF host a second time it lost the data from the first time.
Is there a way in Xamarin Forms to work with cookies over a BasicHttpBinding?
And if so how can I implement these cookies?
I have no experience with cookies.
Related
I am not sure though what exactly to ask since im very new to WCF. So I'll try to explain what I am doing. I need to create a web app with textbox and button. On button_click the data in the textbox should be push on a win form app supposedly to be deployed to a client. So what's connecting them is the wcf service. I am not exactly looking for codes as solution rather a theory or what I am missing. Thanks.
The simple method is to have your web site publish the button state and have the clients poll for updates. That is very easy to do with wcf, all you have to think about is security - if any.
The hard way is to let the clients to "sign" up on the wep application and then push the state to the clients. Each client would need its own wcf listening endpoint that can be called from the web application. The implementation is simple enough, but I'll suspect that you will run into issues with connectivity. Do the end user have rights to open ports for listening in windows? If the clients are behind nat-routers can you be sure that you can connect to them?
I have a Silverlight RIA application that uses Forms authentication. We want to pass users of a certain domain through Windows authentication and if that fails or user is not part of that domain it falls back to Forms authentication.
Most of the stuff I've found was for aspx sites using methods not available in Silverlight. Many others say it isn't possible. Has anybody managed to do this without to much trouble?
The app is based on the Silverlight Business Application template in VS2010 (SL4).
I don't think this is possible. Ran into the same issue and decided to turn off windows authentication.
See:
http://forums.silverlight.net/forums/t/228703.aspx
http://connect.microsoft.com/VisualStudio/feedback/details/566410/enable-wcf-ria-services-with-forms-authentication-and-integrated-windows-authentication
The second link seems to indicate this is a bug that may be resolved in a future release
I have a Silverlight application that on a button opens an aspx page in a new browser window.
I want to pass some username/password details from Silverlight to the aspx page. My understanding is that I should be using WCF services to set the session state, which can then be retrieved from the aspx page.
I have followed what I think are the correct steps, but the aspx page refuses to see the state set by Silverlight.
What I have done is;
Created a WCF service that sets System.Web.HttpContext.Current.Session["Thing"]
On that service, set AspNetCompatibilityRequirements = Required and also set aspNetCompatibilityEnabled="true" on the web.config
My Silverlight application is able to set (and retrieve) session information using this WCF service successfully.
However when I get Session["Thing"] on the aspx page it is blank. Also if I set Session["Thing"] on the aspx page, Silverlight does not get it.
It's as if the two have different sessions - why is this?
Thanks in advance
Matt
Is it possible that the WCF service that your Silverlight client talks to is in a different web app (ie, is there more than one web project)? The default in-proc state provider is really per-appdomain, so if they're in different apps, you'd have two copies of your session state in two appdomains. If this is the case, just move the service code into the same webapp with the pages, and life is good. I can't think of any other explanation- I've done this plenty of times with no trouble.
As far as I can tell, if you open the page in a new browser window, it will create a new session. Your only hope of having the session shared is to create a shared object at the web server level (ugly).
Why don't you just pass the state as a querystring? Or open the page in an HtmlHost link text element withing SL?
I am a beginner in Silverlight. I have developed a Silverlight chat application. In a single Silverlight window open more than one chat windows every chat window create a connection with wcf service but when it reaches 10 then the application is stop working and break all communications from wcf polling duplex service. I already have configured my wcf service web config file with :
<serviceThrottling
maxConcurrentCalls="10000"
maxConcurrentSessions="10000"
maxConcurrentInstances="10000" />
but it has no effect. Do I need to set these settings in silverlight application also? Please hep me. How is it possible to load thousands of chat windows on a one client side.
Thanks
The web browser will only allow so many connections to a web server. There are reg hacks/settings hacks for browsers to modify how many connections. I would rethink your chat window gets it's data from the WCF service. For instance, maybe you send all chatroom data down one wcf client, and have your application send them to their constituents UI.
I have this existing environment:
1) ASP.NET 3.5 web application
2) forms authentication with the SqlMembershipProvider
I need to add the following:
1) a Silverlight charting object embedded in a web page.
2) a WCF service to be consumed by:
a) the Silverlight component embedded in an authenticated
web page, as mentioned above
b) server-based WCF clients with certificate based authentication
My question is - what is the easiest/best way to configure the WCF endpoints for the Silverlight object to authenticate to the WCF service using the security context of the already logged-in user (via the page that’s hosting the Silverlight object) without having to use the user's username/password again?
I've researched a lot of the MSDN and Patterns & Practices material and I thought I had a decent grasp of many of the potential authentication scenarios. But I can't seem to figure out a way to tie them together for the scenario I've outlined. I've found other people posting similar questions to mine but none of the answers I've read seem to fully answer their questions either. (Maybe I'm making this harder than it needs to be?)
I would think that the solution would be to somehow use the authentication token/cookie generated in the asp.net form login and somehow pass that to the Silverlight object which then includes it in the WCF request. But I don't see how to configure the WCF endpoint to use that token.
(In some of my other projects I've implemented the server-to-server scenario in 2.b above using certificate-based authentication, so I'm not too worried about adding that to the current mix I've outlined.)
Thanks in advance for any insight or pointers to the path forward.
Terry
Thanks codemeit for trying to help but I finally figured out what I was doing wrong - it was pilot error.
In trying to configure the endpoints for my Silverlight app I was testing with an asp.net page. I finally realized that when I test that way, the client endpoint is no longer originating from the authenticated browser - the client endpoint is the IIS server which in turn executes the request against the WCF server endpoint. So the security context changes and HttpContext.Current.User.Identity is always empty at the WCF server endpoint.
Once I got my test SL app running in the browser, it automatically inherited the security context of the authenticated browser and then HttpContext.Current.User.Identity was correct and authenticated at the WCF server endpoint.
Have you tried to enable your WCF services with aspNet compatibility, then see if the following is true.
string currentUserName = HttpContext.Current.User.Identity.Name;
bool isLoggedIn = HttpContext.Current.User.Identity.IsAuthenticated;
if these properties are being populated with the expected values, then this is the one you are after.
To enable aspNet Compatibility
add to web.config
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
add to the service impl class
[AspNetCompatibilityRequirements
(RequirementsMode=AspNetCompatibilityRequirementsMode.Required)]
In this case, the endpoint would be using basicHttpBinding, and you could check the authentication at run time within WCF.