Converting MVC-3 project to windows azure - c#

I have a project in MVC-3 which i am going to convert in Windows Azure project and will use blob storage.
My question is that i have some user specific information in my project which is stored in ASP.NET profile and in database table. Like images names uploaded by specific user and others. So while changing we will remove this profile and database table info also. Or keep this information as it is or just changing the location on which the images and other data save ( means from on-premises hard-disk to Windows Azure data center. )
Sorry if this is the odd question but i am pretty new in Azure. So can any body please explain me ?

The easiest method would be to use SQL Database (previously known as SQL Azure) and edit your connection string pointing to SQL Database (from on-premise SQL database). You will also need to migrate your SQL database schema/data from on-premise to SQL Database. This way your migration will be much easier and you would not need to make any significant changes to your code.
If you decide to use Azure Table Storage, the you will do significant changes to your code to store user specific data to a key-value pair type of storage (i.e. Azure Table Storage), depend on how complex your tables is, this may be a choice or may not be.
As you mentioned that you have user specific information in ASP.NET profile/database tables however i think you application also require users to upload images so this is also important factor while migrating your application. While migrating your MVC3 application to Windows Azure Cloud Services, you would need to move images or any static content you keep on local disk based storage to Windows Azure Blob Storage (persisted network storage) so the code change will require to read and write data to and from Azure Blob storage, in lpace of your local machine storage. This is also a must code change in your code otherwise the image data uploaded by user will not persist and prone to lost if VM reimaged due to several other reasons.
Others may have different idea but I would personally prefer using SQL Database as a choice to reduce complexity during migration as you could pretty much migrate your database table to SQL Database with just a few lines of code change.

Related

In UWP, where should I save user data?

I made an UWP app for Microsoft Store. However, user data automatically saved in the LocalState folder will be deleted every time the app is updated. I want the data to be retained after every updating, so I'm trying to suggest the users to save their data by themselves in the Document folder or somewhere to avoid their data deleted, but I don't want to bother them. Where should I save user data?
The roaming folder will be unable to use in future and I don't want to use Azure because of its fee.
The common approach is to store the data in some remote location, like for example in the cloud. You would typically use a service of some kind to request and save the data.
If you think Azure is to expensive, you'll have to find a cheaper storage solution. The principle is the same regardless of which storage provider you use.
As mentioned in the docs, roaming data is (or at least will be) deprecated. The recommended replacement is Azure App Service.

Is it possible to encrypt an SQLite database when using offline data sync in Azure Mobile Services?

I have a WinRT app that saves an SQLite database using Azure Mobile Services. I followed the tutorial here: Using offline data in MobileServices
I got the database working, but I was wondering if it was possible to either encrypt or password protect the database file that is created with this line
var store = new MobileServiceSQLiteStore("localstore.db");
I'm trying to add in an extra layer of security to protect sensitive information. Passwords and such aren't stored in the database, but other information that the user enters may need to be protected and synchronized with a service hosted on Azure. Otherwise, someone could potentially navigate to C:\Users\[username]\AppData\Local\Packages\[packageId]\LocalState
and open the database with any SQLite database browser program. I could encrypt the data that is saved in the classes before it is saved to the database, but it would be preferable to encrypt the database file if possible.
Azure Mobile Services doesn't currently have an API to password protect or encrypt the SQLite database on the device. You could contribute or provide a feedback to the open source project.

How to save user data in C# Winstore Metro app permanently?

I have some user data in my Winstore C# app. I just learnt that local store and app data are being erased after new version of the app is installed (or user reinstalled the app).
How to permanently store the data? Can it be done transparently for the user?
What about enterprise class of apps - how do you guys access more robust data like databases?
Removing all local data when an app is uninstalled is the expected pattern for Windows Store apps.
If you want to store data permanently, my recommendation is that you consider building a back-end data store and services to access them. Then you control the server-side data, and can associate the data with the users when they install your app (note that if you plan to store data and not delete it when the user uninstalls the app, you should probably call that out in your app's privacy policy).
There are several good options in terms of building back-end services, and I explore several of them in a blog series I'm currently working on:
http://bitly.com/bundles/devhammer/2
The series covers building a back-end game leaderboard service which stores data in a SQL Database on Windows Azure (though the concepts are applicable to services you host yourself as well), using one of 3 stacks:
WCF Data Services
ASP.NET Web API
Windows Azure Mobile Services
Any of those three stacks will allow you to create a robust back-end for your apps, and can be leveraged across platforms.
With respect to transparency, you can definitely make the above services functionally transparent to the user, but as noted above, it's a good idea to also be transparent about the fact that you plan to continue to store data after the app is uninstalled, and perhaps even give the user options for deleting their data. Pete Brown recently posted a good overview of traits of a good Windows Store app privacy policy, and addresses this a bit in the post:
http://10rem.net/blog/2013/01/21/traits-of-a-good-windows-store-app-privacy-policy
For more info on Windows Store app development, register for Generation App.
You can use something like Skydrive or Dropbox to store the files.
EDIT*
There is no database access support in WinRT. While you can use something like SQLite to store data locally - it would be used mostly for caching and it would be expected that you persist the data somewhere in the cloud, so you should still upload the data you want stored somewhere outside of your machine.
If you want to store files on your machine that don't get deleted with your app - you can save them somewhere in the documents/pictures/music/videos libraries, depending on where they fit best.

Shared Application

I am creating an application to be accessed by multiple clients, but
each customer will have a different database, only access the
same application in IIS, I'm using DDD, C # and MvC3 and Entity Framework 4.1 CF. Does anyone have any example or an idea of how best to configure the connection string
specific to each client?
First, you need to identify whether it's a database per client (machine?), user identity authenticating, or some other identifier. For example, if it's per account, then two machines may be able to authenticate as that account and get the same storage.
Once you have that identifier, you'll need a master table somewhere with a map of account to database connection string. You'll probably also want to cache that table in memory to avoid two db roundtrips on every request.
That global configuration information is typically stored in a database. You could go as simple as a file but that would cause problems if you ever wanted to scale out your front end servers, so common storage is best.

Asp.net C# Fileupload and Access Interaction

I'm building a webapp that needs to interact with a Access Database. The Access database is about 200 megs and I don't want to upload the entire thing...just the contents of one table. So far, I've used Microsoft.Office.Interop.Access in the past on a desktop app but when I tried this on a webapp there is some cryptic permission issues on the web server(I think) that need to be ferreted out.
As far as I understand it I can
1 - upload the entire database and select the data
2 - I can use interop and figure out the permission issues
is there a 3 or 4 option?
Thanks guys.
The location of the access file doesn't matter as long as it is accessible local or through the network and the NETWORK account of the webserver (if it is a Win2K3 or higher server otherwise it's the ASP.NET account) has access to that location.
So no need to download or upload anything.
Also... the fact that your back-end is dealing with an access database shouldn't be visible or be of any concern to the client...
OTOH if you are looking for a solution to "manage a database through a web interface", then maybe it's better to look at something like this... (It's for sql server, but migrating from access to sql server isn't that big an issue ;-)
If you want to code it yourself, i think this post can come in handy.
No need to interop, just use an OleDbConnection with the right connectionstring.
I don't know if i understood your problem but maybe you could upload the table data using a CSV file, then parse every line and use a SQL query to INSERT this data the Access database.

Categories