OneDrive shared appFolder - c#

I'm using the c# UWP OneDrive Api and have two questions:
Is the exchange (sending and receiving) of files + login via this API always encrypted?
Is it possible to share the Special Folder App Root with two Apps? Like I have an App A, which is free and an App A pro, which costs something and I want to make it very easy for the user to use his/her data from App A in App A pro without him/her having to change anything, but just login to OneDrive and the App fetches the necessary data from App A free version.

All connections to the OneDrive API are via https encrypted channels.
The App aspect is build around the application id that you use to communicate with the OneDrive service, you could have two separate applications on a Android/iOS app stores one free and one paid that use the same underlying application id.

Related

ASP.NET Core 5 API write files on Azure Web App disk space

I do have an ASP.NET Core 5 Web API project which is currently hosted as an Azure Web App on a Windows App Service plan. Since I have a couple of gigabytes of storage associated with the App Service plan, I want to use 10 GB for an image cache where I store images generated from the API.
Here is some context:
I don't want to use Azure Storage / Blob Storage for this to avoid unnecessary traffic costs and delays. Some images are generated from multiple layers of other images (let's call them intermediate images) and I cache everything.
My caching solution works fine locally, but currently not on Azure.
I want to use 'Remove additional files at destination' when publishing a new version of my API.
The cache will be cleared/invalidated via an API call, not on deployment or app restart.
As I've said, the caching works fine if I run at locally on IIS Express. As far as I know, the Windows App Service plan uses Kestrel for hosting. I'm looking for a storage path within the Azure Web App, where I can create and delete directories + create/read/delete files.
Since the App Service Plan is B1, the App Service plan is running on a dedicated Azure VM, according to the docs: https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans
From https://learn.microsoft.com/en-us/azure/app-service/operating-system-functionality, I've learned that there is a C drive and a D drive as well.
From my web app, I can select Development Tools -> Advances Tools -> Go to see Kudu. When I click on Environment in Kudu, I can see some absolute paths that I've tried to write to without success. I've also tried to access
Environment.GetEnvironmentVariable("HOME")
IWebHostEnvironment.WebRootPath
IWebHostEnvironment.ContentRootPath
"D:\home\site\wwwroot"
"D:\home\"
without success as well.
I also tried to add a virtual directory (since I want to store images in another directory to be able to use the 'remove additional files on destination' option). I also connected via FTP to /site/wwwroot/ where I can see my deployed application.
In the past, I was able to read files from a virtual directory from an ASP.NET Webforms application, but with this ASP.NET Core 5 API project, I didn't have any success mapping relative paths to absolute paths.
My main question is: What absolute path to I need to use in my API project to have create/delete directory permissions and create/read/delete file permission into my Azure Web App?
Okay, I've figured it out. I had some fatal errors when starting the application. It seems that they were related to ApplicationInsights. I removed it completly from the Azure Web Portal and now everything works.
The following path works as a base path D:\\home\\

Separate Web application using sub domain name in Azure

We are developing an online CRM Saas product in .Net Framework. Now we want to provide this service to anyone.
Any user wants to use or try our service they just need to put a few basic details and click on Sign up.
There is one best example of my above statement is confluence, as soon as I sign up with some site name my confluence portal is stared.
https://www.atlassian.com/try/cloud/signup?bundle=confluence
Now how to do the same in Azure, I have only files and folder of my application. How to create separate websites for multiple users with a single domain name. If I programmatically created multiple azure apps using Azure ARM then it becomes very difficult to maintain our product. How to do achieve this functionality.
To host multiple apps under a single domain, if you’re leveraging Azure Web App and deploy your web applications to each virtual directory with the name which could identify your web application.
You could keep your web sites in separate projects and use the ‘virtual directories and applications’ settings in Azure to publish the two different projects under the same site.
Go to WebApp -> Settings -> Application Settings -> Virtual applications and directories.
In Web Apps, each site and its child applications run in the same application pool. If your site has multiple child applications utilizing multiple application pools, consolidate them to a single application pool with common settings or migrate each application to a separate web app.
You may want to check the blog post Deploying multiple virtual directories to a single Azure Website for more details.
Also, you could also use Application Gateway infront of your app since you can do path based routing with app gateway i.e testing.com/one points to one web app and testing.com/another points to the other app. You could start out with the example below the modify the back end to use path-based routing. Kindly refer the links below one that covers the basics of configuring the App Gateway with a WebApp and one discussing path based routing:
https://blogs.msdn.microsoft.com/waws/2017/11/21/setting-up-application-gateway-with-an-app-service-that-uses-azure-active-directory-authentication/
https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-create-url-route-portal#create-a-path-based-routing-rule

Where do I store media in an Azure Web App with C# ASP.NET

I am creating a C# ASP.NET app (using Visual Studio), which I'm hosting on Microsoft Azure. Currently, I have a folder in the solution named "Content", in which I store some media. For example, there a logo that is placed on the website.
The purpose of the web app is to generate a document that a user can download after entering some data. To generate this document, I also need to use some media (mainly images). There can be quite a lot of such images!
Where should I store these images? I currently have them in this "Content" folder as well (in seperate sub folders for each user), but I noticed on Azure there is also a tab called "Storage". I have tried to use this service for a bit, but I don't really understand its purpose. Would it be advisable to use this for storing the media, and then retrieving them with the web app when necessary, or should I leave them on the web app server? What is considered Good Practice?
Thanks in advance for any help
As a starting point, using Blob storage (see Azure Storage Documentation) would be significantly better than file storage on a single webserver - its cheaper and more scalable (pricing tiers for Application server storage will be expensive, you'd have have to duplicate files or have a multi-server directory in a load-balanced environment). The basic design is the application will use an SDK to retrieve the bits and then stream it back to the web browser or other client.
If you anticipate many users downloading the same file, and network performance matters, consider using a Content Delivery Network
You should store it in an Azure Storage Account and reference it using the SDK, after generating the document, you can use Shared Access Signature to give the user access and you can limit the access to read or write for a specific time.
If you will generate videos then you can serve it through Azure Media Services

Upload files to a specific folder on Onedrive in web application

I want to upload files to a specific folder on my onedrive using C# in web application. I am not able to find any sdk for that. All i can find is sdk for windows phone application. Thanks you in advance.
The OneDrive SDK is still valid for use in any .NET language/platform, including ASP.NET.
For web-based applications, you'll need to handle authentication yourself though. Because of the various ways of authentication a web app, the SDK didn't provide a prescriptive authentication solution for web apps.
You can either code the OAuth 2 implementation or use an existing library to connect it up (like using OWIN). Once you have an access token for OneDrive, you can provide the token to the SDK and then use the SDK as normal.
The webhook sample project in the OneDrive org has an example of how to provide an access token directly to the OneDrive SDK by way of creating a OneDriveAccountServiceProvider.

Looking to create a webservice for client authentication and need some advice

I am developing an android application to accommodate some desktop software that I created. I would like for the user of the mobile app to have to verify their identity through authentication. Basically the web service will have to act as a central hub to both authenticate and hold information that the android app will need. The way I think it should work is to
-Set up a central web service
-Allow user to create account from desktop client using email/password
-The desktop client will send the information to the webservice that the android app will need.
-when android app is authenticated it will then retrieve the data it needs that was posted from the client.
So basically the service will need to be able to send and receive data.
I will only be using .net (either C# or vb.net ) for the service, so this leads me to a couple of questions:
Should I be using WCF for this? If so should I create a WCF Service library or WCF Service application?
Should I be using the Sign Sign on service approach?
The web service doesn't need to be fancy it just needs to get the job done. Is their any boilerplate project templates or projects out their I could use to help build a foundation?
I recently discovered SudzC.com which generates classes and methods for Objective-C from the wsdl data of a .net web service, and I'm fairly sure it also does Android.
I have a huge catalog of fairly 'old' web services which pre-date WCF and they are currently working perfectly.
I should point out though that the SudzC service only shows you what it can do for you for free - to get the code you have to pay ~£20 for a one year pass.
We had something similar where I worked. We had to put together an Android app for the company. If you are on .net 4.0 or newer, you can take advantage of theWebApi. It can return json or xml. So, that means any platform can utilize it (desktiop, android, etc...). I found it extremely easy to use, with very little overhead.

Categories