Facebook-C#-sdk: v5 Security exception - security

I'm still new with facebook C# sdk (ASP.net) I'm using Facebook C# SDK v5 sample "CSASPNETFacebookApp" everything well when in the development machine, but when I upload it on my Godaddy Shared Hosting I got a secuirity exception:
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Configuration.ConfigurationPermission, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.
Please advise me on how I can fix this? Or its better to change a hosting server?

I had this issue and fixed it by adding a "trust level" setting of Full to the system.web section of the web.config file:
<system.web>
<trust level="Full" />
Check out this MSDN article for details and implications of setting this.
Hope this helps.

<section name="facebookSettings" type="Facebook.FacebookConfigurationSection" requirePermission="false" />

Related

AADSTS700016: UnauthorizedClient_DoesNotMatchRequest

Not sure if this is the right place to ask but... We have an older application that is set up to use SSO, currently Azure ADFS. I want to use login.microsoft.com url instead of our organizational url that has been used in the past.
I replaced the currently working links in web.config with the endpoints from Azure
<appSettings>
<add key="FederationMetadataLocation" value="https://login.microsoftonline.com/dfmi.onmicrosoft.com/FederationMetadata/2007-06/FederationMetadata.xml" />
</appSettings>
and
<federatedAuthentication>
<wsFederation passiveRedirectEnabled="true" issuer="https://login.microsoftonline.com/0845a734g7-6d23-7c96-9f4x-3427v39n4sd5/wsfed/" realm="https://customdfmi.dfmi.net/" requireHttps="true" />
<cookieHandler requireSsl="false" />
</federatedAuthentication>
I get to the sign-in page. When I put in the credentials it shows "AADSTS700016: Application with identifier 'https://customdfmi.dfmi.net/' was not found in the directory".
It is set up in Azure. Redirect URI is the exact copy of what's in web.config. What am I putting wrong in web.config? Do I need to put the Application ID somewhere in it? Any pointers would be great. Thanks!
Did you received this message?
AADSTS700016
UnauthorizedClient_DoesNotMatchRequest - The application wasn't found in the directory/tenant.
This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have misconfigured the identifier value for the application or sent your authentication request to the wrong tenant.

O365 example setting fails

I just start to learn new Office 365 API. I'm also not so deep understand server-side programming. I have VS2013 and all pre-requisites as pointed in the link bellow. Some example with Windows Desktop App worked. But when I get example https://code.msdn.microsoft.com/Office-365-APIs-Get-d75d1c8a - it fails during setting up in Service Manager after Sign-In to O365.
The error message - "Unsupported or invalid query filter clause specified for property '' appId of resource 'Service Principal' ". This message appear instead permissions in Service Manager. When I press OK - "Sign In" point in Service Manager still there - Authentication Failed.
Please help!
You need to remove the existing client id and settings from app.config (or web.config in web project). When I removed the following from App.config in the Office365Api.Demo project, I was able to register the app in my own Azure AD.
<add key="ida:ClientId" value="[put here your ClientID]" />
<add key="ida:RedirectUri" value="http://localhost/eb2c041088c22f67fecaffda29528308" />
<add key="ida:AuthorizationUri" value="https://login.windows.net/" />

Unable to authenticate on SharePoint Online using the BizTalk SharePoint adapter

I have the following issue when using BizTalk 2013 ("R1") and SharePoint Online:
I have a static send port configured to add data to one specific list in a list in a SharePoint Online environment.
I have authentication setup using the username and password and I'm 100% sure this is a correct username and password. I'm able to login using the same credentials via a browser without problem.
FYI: the account used is a "Microsoft" only account, so not listed as an organizational (work/school) account as well.
Whenever I try to send something to the list, I get the following error:
A message sent to adapter "Windows SharePoint Services" on send port "SP_SharePointOnline" with URI "wsss://company.sharepoint.com:443/sites/poc/Biztalk-Demo/TR/Lists/List%%201" is suspended.
Error details: [System.ServiceModel.CommunicationObjectFaultedException] The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
This error was triggered by the Windows SharePoint Services receive location or send port with URI wsss://company.sharepoint.com:443/sites/poc/Biztalk-Demo/TR/Lists/List%%201.
Windows SharePoint Services adapter event ID: 12310
I have enabled WCF and WIF tracing in the BizTalk BTSNTSvc.exe and BTSNTSvc.exe.config as follows:
<system.diagnostics>
<sources>
<source name="Microsoft.IdentityModel" switchValue="Verbose">
<listeners>
<add name="wif" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
<listeners>
<add name="wcf" />
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\logs\WCF64.svclog" type="System.Diagnostics.XmlWriterTraceListener" name="wcf" />
<add initializeData="C:\logs\WIF64.svclog" type="System.Diagnostics.XmlWriterTraceListener" name="wif" />
</sharedListeners>
I get WCF logging, but I don't have any WIF logging (as I would expect).
The WCF logging provided the following as to why the channel faults (extract from WCF Trace Viewer):
<S:Fault>
<S:Code>
<S:Value>S:Sender</S:Value>
<S:Subcode>
<S:Value>wst:FailedAuthentication</S:Value>
</S:Subcode>
</S:Code>
<S:Reason>
<S:Text xml:lang="en-US">Authentication Failure</S:Text>
</S:Reason>
<S:Detail>
<psf:error>
<psf:value>0x80048821</psf:value>
<psf:internalerror>
<psf:code>0x80041012</psf:code>
<psf:text>The entered and stored passwords do not match.
</psf:text>
</psf:internalerror>
</psf:error>
</S:Detail>
</S:Fault>
As said: I'm 100% sure this is the correct username and password!
I'm stuck here, anyone able to help me out or point me in the right direction?
Why don't I have any WIF logging?
Regards,
I think there is a problem in your URL. what if you try to use in the utl the link to your sharepoint site and the name of your List as "Destination Folder URL".
you can check this walkthrough

Exposing OData via WCF RIA Services

I've created a new Silverlight application, so I have a web project called "SilverlightOnLineChess.Web" and the Silverlight app called "SilverlightOnlineChess.Client". In this solution I've created a new WCF RIA Services class library called "SilverlightOnlineChess.Data", and in doing so it creates the associated web project called "SilverlightOnlineChess.Data.Web". I've created the necessary Entity Data Model and the domain service classes in the "SilverlightOnlineChess.Data.Web" project and made sure I checked the "Expose OData endpoint".
Everything works fine and dandy to view data via the app. However, if I try to hit the url to see what the OData brings back as in:
"http://localhost:49771/SilverlightOnlineChess-Data-Web-OnlineChessService.svc/OData/" it doesn't know what this url is. It only works if I create the services and entity model in the main web project "SilverlightOnLineChess.Web" and not the "SilverlightOnLineChess.Data.Web".
So now if I enter the url as in:
"http://localhost:49771/SilverlightOnlineChess-Web-OnlineChessService.svc/OData/", it brings back the metadata.
Any ideas?
The URL of the Service occurs as follows:
Namespace + typename for the domain service with dots replaced by dashes followed by .svc/OData/.
After this you need to expose queries to OData by adding
[Query(IsDefault = true)]
above your queries you want to expose.
To expose an OData endpoint, you need to make sure you have the following in your web.Config:
<system.serviceModel>
<domainServices>
<endpoints>
<add name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, System.ServiceModel.DomainServices.Hosting.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</endpoints>
</domainServices>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
You also need to make sure you are referening the following DLLs:
System.ServiceModel.DomainServices.Hosting.OData
C:\Program Files\Microsoft SDKs\RIA Services\v1.0\Libraries\Server\System.ServiceModel.DomainServices.Hosting.OData.dll
You can make sure you're looking for the right URL to your OData service by looking in your client-side project with Show All Files selected. Go to Generated_Code\ProjectName.Web.g.cs. Do a find for Service.svc. That will be the root URI of your OData service. If you put your domain service under a Service folder it will be Service/YourServiceName.svc/OData/.

SharePoint form-based authentication with custom database

I have SharePoint site and I want to use form-based authentication, not Windows how it is by default.
For this I read that I have to modify the web.config from Central Administration and web.config from my site with the membership and roleManager tags configured properly.
But if I use this:
<membership>
<providers>
<add name="MyProvider"
type="System.Web.Security.SqlMembershipProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
.../>
</providers>
</membership>
System.Web.Security.SqlMembershipProvider requires a database generated with ASP.NET SQL Server Setup Wizard (aspnet_regsql.exe), and this is my problem!
I want to use another database with cunstom table 'Users' from where to take the username and password for authentication.
How can I do this?
Thank you in advance
If you have a custom database structure, then you will need to write a custom MembershipProvider. I suggest starting here on MSDN.

Resources