Reputation: 11
I am making a web and desktop application in C# for my elementary students, so that they can log onto the web and download the program for their classes. Both the web and the application will be found in Azure Storage.
The application I created is very small since it only takes care of downloading and executing the necessary dll where the forms with the classes and exams will be.
The problem I have is that I want the login data (username and / or password) to be sent as parameters in the application so that they don't have to log in again in the desktop application.
I tried to make the application read cookies in some way, but discard this idea because it depends a lot on the browser.
The other and more understandable idea is to create a web service that generates the executable file (exe) in memory (it has to be in memory because I don't have write and read access to disk, I'm using Azure Storage and Azure Service) and it Download using filestream or something similar.
I found this example but this necessarily needs a directory to generate the exe file, is it possible to generate the exe file in memory?
Or if it is possible to pass parameters to a compiled exe file.
Public Sub generateFile ()
Dim codeProvider As New VBCodeProvider ()
Dim icc As ICodeCompiler = codeProvider.CreateCompiler
Dim Output As String = "C: \ Program Files \ MyApp.exe"
Dim parameters As New CompilerParameters ()
Dim results As CompilerResults
'Make sure we generate an EXE, not a DLL
parameters.GenerateExecutable = True
parameters.OutputAssembly = Output
parameters.CompilerOptions = ("/ target: winexe" & "" & "/ win32icon:" & "" "") & "C: \ Program Files \ MyIcons \ Icon.ico" & "" ""
results = icc.CompileAssemblyFromSource (parameters, txtCode.Text)
If results.Errors.Count> 0 Then
'There were compiler errors
Dim CompErr As CompilerError
For Each CompErr In results.Errors
MessageBox.Show (
"Line number" & CompErr.Line &
", Error Number:" & CompErr.ErrorNumber &
", '" & CompErr.ErrorText & ";" &
Environment.NewLine & Environment.NewLine)
Next
Else
'Successfull Compile
MessageBox.Show ("Your file is successfully generated!", "Success")
End if
End Sub
The desktop application is small, it is only responsible for downloading and executing the last dll contained in a directory in azure storage, the classes and forms will be in these dll.
Thanks so much for reading. I apologize for my English, I'm from Argentina
Upvotes: 1
Views: 224
Reputation: 54618
The problem I have is that I want the login data (username and / or password) to be sent as parameters in the application so that they don't have to log in again in the desktop application.
This is not a simple thing to do. Here are the steps I would recommend along with the User Experience.
User Logins To Web Site
User Downloads Installer
User Starts Installer
a. During installation, application registers a custom URI Scheme Registering an Application to a URI Scheme
Now the following is the same regardless if it's after installation or the user is executing the application.
This is very common. Applications like GotoMeeting, Slack, Discord and a variety of others all do the same thing.
Upvotes: 3