Passing dynamic data with click once application - c#

I have a web page where the user provides the input and press the Submit button. On button click I'm downloading the click once application to process the input on client machine. Currently passing the input as query string parameter to the click once application.
i.e. myapp.application?
But there is a limitation in the Query string, that I cannot send the data more than ~2000 characters, Is there any way that I can attach the data along with the download of click Once application?

ClickOnce uses manifest file to define, what files should be downloaded. I hope, you are using signed manifest for application deployment. Signed manifest contains package files hashes as well as hash of the manifest itself. You can put the data into the file, which is defined in the manifest. However, you will have to generate manifest file dynamically every time a user requests application installation along with new portion of data. This can work fine, if the user removes the application right after data processing has been finished. But it can easily out of control eventually.
I would try another approach: store the data on server side and put id value into query parameter string. The application can request the data from the server by provided id. Just make sure that the data is protection is consistent with its sensitivity. For example, if it is some kind of private user information or data protected by law, you need to make sure that only authorized user can get it from the server and the data is stored in secure manner.

Related

Perstisting local data after update from app store

I'm developing an app for android and ios with Xamarin.Forms where I have to store data, which the user enters.
The data may never be deleted, except the user deletes them within the app or by deinstalling the app. But the data must be persisted when the user installs an update via the app store.
Also the data (which is a json string) contains no token or other temporary data. Every day the data could be increase by 200-300 string characters.
At the moment I use Application.Current.Properties, but I'm not sure if it fits both of my requirements...
Which framework/approach is the best for it?
Just write your json string into a file. You'll get it back after an update.

ASP.NET: Handling server cached file for short-term

I have this specific scenario:
The user is sending me request which contains a URL to a file in my private repository.
The server side catch this request and Download the file.
The server making some calculation on the downloaded file.
The server sending the results back to client.
I implemented this in the "Naive" way. Which mean, I downloading the file (step 2) for each request. In most cases, the user will send the same file. So, I thought about better approach: keep the downloaded file in short term "cache".
This mean, I will download the item once, and use this for every user request.
Now the question is, how to manage those files?
In "perfect world", I will use the downloaded file for up to 30 minutes. After this time, I won't use it any more. So, optional solutions are:
Making a file system mechanism to handling files for short terms. Negative: Complex solution.
Using temporary directory to do this job (e.g. Path.GetTempFileName()). Negative: What if the system will start to delete those files, in the middle of reading it?
So, it's seems that each solution has bad sides. What do you recommend?

Open url in browser and fill asp.net popup with values from wpf application

I have a Wpf application and I want to open url (asp page) and fill popup with values (login, password). How can I do it?
Now I open url with Process.Start:
var processStartInfo = new ProcessStartInfo(url);
Process.Start(processStartInfo);
But I can't find out a way to fill popup..
I find way to use webControl... but I need to open url in browser..
My first recommendation is to think whether a mechanism like this is really necessary because it deals with a lot of sensitive Information. If you can avoid it, I'd recommend not to use at least the password.
Can you make changes to the ASP-page? Then you can add some request parameters that the ASP application fills into the fields, you could do that.
However, in this specific scenario I strongly recommend NOT to fill the username and password directly in the URL because it can be read easily along the path. If the application runs in a completely safe, controlled area, one can argue about the username, but I would not recommend it.
What you could do is to create some kind of token mechanism, so that you do not transmit sensitive data:
WPF application creates token, e.g. in database. It is important that the token is random and cannot be guessed, maybe a GUID. Also it should be valid only for a short period of time. Also the WPF application stores the necessary login Information in the database.
WPF application opens the browser with an URL like https://srv?token=<random token>.
ASP application receives token through request Parameter, checks whether it is still valid and signs user in using the Information that is stored along with the token. It deletes the entry in the database immediately so that the token cannot be reused.
This approach requires you to be able to make changes to both the WPF application and also the ASP application.
And as said above, if you can avoid it, it is preferrable to have the user enter his or her credentials manually.

How to detect if there is some fire wall or other causes which prevent me to connect to a specific server?

If my web application has a specific component(widget) which make a connection to another server(which is out of control) to read from an xml file .
sometimes the admin of the server which i connect to put a firewall or change some configuration . and when my application try to connect to this server it takes long time before the widget comes empty.
The problem is the time trying to connect to that server is a part of the time to load the page . and i feel there 's some thing wrong with all this time to request the page !
How can i determine if i can connect to that server to read the data or there is some issue which prevent me to do this.?
I don't quite understand what your widget is composed of and thus why it blocks the loading of the page. But two ways to decouple the widget for the page loading are:
Put the widget in an iframe element.
First insert a placeholder for the widget (e.g. a div element and a Loading... text). Then, after the page has loaded, use Javascript to replace the placeholder with the effective HTML.
Are you allowed to use this XML feed on your site? If not, they may be deliberately blocking your access to it.
However, I would cache the XML file locally, and let a cron job regularly pull the newest version from the other server.

how many times a file has been downloaded

I am creating a web browser using C#, and I need to get specific data from the web pages that are loaded in my browser.
The pages I am loading is a download scripts. The data I want to get is: the number of times the file has been downloaded.
I want to save this value in text.
What code can I use for this, or where can I start? Any help is appreciated.
Most web browsers have their own storage. Mozilla uses SQLite for some things.
Whenever your app/browser needs to retrieve a remote resource (URL of any kind), simply log it to a database table.
Perhaps use SQLite yourself for this. A decent start would be to create a history table like this:
URL --varchar(max)
LastAccessed --datetime
TotalRequests --int
If it is a file that the users will be downloading, you could add a global static int and increment it every time the file is downloaded.

Categories

Resources