How to create ASP.NET page to act as a "proxy" for Silverlight WebClient? - vb.net

I need to create an ASP.NET application to access a URL, when this application is live it is able to access the feed URL correctly as the clientaccesspolicy.xml and crossdomain.xml are on the server but only allow non-localhost connections so the debug version won't connect.
How do I create a file, so this kind of link:
http://localhost/feed.aspx?item=ItemName
Can be used to pass-through to the RSS feed service live URL like:
http://www.example.com/feed.aspx?item=ItemName
So that I can develop my application via localhost as I can add a clientaccesspolicy and crossdomain file to this application so my Silverlight Application can access the live RSS service, while being developed without having to deploy it online every time I need to see what the application will look like.
A dummy RSS file is not suitable as I need to see various "Items" from the Feed.

Your page, feed.aspx, must read the RSS feed you want Silverlight to display and display it.
Use an HttpWebRequest in your .aspx page codebehind to get the RSS feed data
Post the feed data out to the outgoing stream via Response.Write
Thus the page acts as a proxy. Your Silverlight app will read the data from your local page as if it was a regular RSS feed.

Related

Planting an Iframe as Aura component to show an external system that receives information from Salesforce API using oAuth web server flow

I have built a web app for our sales team.
The web app is currently using oAuth web server flow in order to authenticate with Salesforce.
Everything is working fine when running it on a separate tab.
We recently wanted to add some functionality from within Salesforce specific objects and display information from our web app.
So I've built an aura component displaying an Iframe with the URL from our web app.
Unfortunately, it crashes with a console error
Refused to frame 'https://***.my.salesforce.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'none'".
So I went to Salesforce's login page and indeed, there is a policy header that prevents it from being loaded from within an Iframe.
What is the correct way to authenticate the user with Salesforce in this situation?
Thank you very much
If you are calling a web app inside of an Iframe(Aura component) it would require the Salesforce domain calling it to be whitelisted in the web app.

Cumulocity File Repository

I am trying to load a csv file in the Cumulocity -> Administration - > Management - > File Repository. My objective is to access the file contents in the HTML widget and show the data in tabular or chart format.
I tried using the fetch() method to use csv file url , but it was not able to fetch the file. The file I believe has been locally stored into the Cumulocity platform now. How can I access the file via fetch().
You are trying to abuse the HTML widget for something it wasn't designed for.
Instead of hacking such logic into the HTML widget you should just extend the Cockpit application with your own widget which is honestly not much more difficult using the WebSDK. https://cumulocity.com/guides/web/introduction/
There is a XSRF protection to prevent exactly what you are currently trying: Bringing in custom javascript code into the live application and trying to access the platform API by "hijacking" the cookies of the logged in user (and you would either need the cookies or hardcode some credentials as you cannot access the API unauthenticated).
If you use the SDK there is even a proper Angular service in order to fetch the file for the API.

Access web camera - .NET Core Web Application

Is there a possibility to access a web camera from Razor Page level (.NET Core 2.1 Web Application)?
I am aiming to achieve online QR code scanner. I am almost sure that I can process captured image with ZXing.Net. What I am missing is the video captured from camera (and as the result screenshots with QR codes).
You can only access the camera client-side (given user permission to do so), not server-side. But, if you need the still server-side, it's just a matter of making an AJAX call following to send what you capture client-side back to the server.
For accessing the camera client-side, see: https://developers.google.com/web/fundamentals/media/capturing-images#access_the_camera_interactively

OData REST API for integrating MS Office

I need to open office documents from my Sensenet client application. My client application is in ReactJs and I need to invoke the document to open in MS office. Is there any OData REST API available for doing the same. Kindly help.
You have two options:
1. open a file in a desktop MS Office application
There is an action in sensenet that gives you the url for that. First, get the actions for a document, using a request like this:
https://example.com/odata.svc/Root/Content/myworkspace/Document_Library('abcdef.docx')/Actions
You'll get the list of available actions, which is a JSON array containing action properties, for example a url. Look for the action named EditInMicrosoftOffice. If you display the URL of that action and the users clicks on that link, the browser should open the appropriate desktop office app (e.g. Word). You may notice that the format of the url is special (something like ms-word:ofe|u|https://example.com/Root/...). Please do not try to assemble this url manually, use the one that sensenet generated for you.
2. open and edit a file in the browser
This requires Office Online Server to be installed and configured in your environment, and you also need to display an html containing an iFrame that'll display the editor.
A simple host page:
https://wopi.readthedocs.io/en/latest/hostpage.html#host-page
Geting data to display the host page:
https://example.com/odata.svc/Root/Content/myworkspace/Document_Library('abcdef.docx')/GetWopiData

How to upload file directly to MVC4 web application

I have this MVC4 web application that does CRUD actions for my database. Now I need to upload log files from native mobile application to database. Since it upload log file directly from mobile application code, it does not use RAZOR web page. I'm not sure how to set controller parameter to accept log file. Please give me some hint!