The best option is to take the code you would use to encrypt and decrypt and place it into it's own windows library project. This way the code compiles to a DLL that could be included in both applications. All that is required then is to write the UI that
is required for each platform, and then when you hit submit handle the inputs and pass them to your encrypt/decrypt objects.
Don't forget to mark useful responses as Answer if they helped you towards a solution.
do not call winforms controls from asp.net page....what you can do is that make such code which needs to run in moire trust and put it in silverlight...if you want to run that particular code on client side...
if you need some specific code to run on server, then you can think of windows services etc....rather than calling windows forms application form asp.net page...
Thanks for reply, I want to explain that my project about encrypt file with password and then upload it in server, then when person need that file he will put the password and then the server will decrypt the file and start download... In fact I built the
project in windows form but I need the program like a page instead of using program
mkf
Member
7 Points
54 Posts
How can use windows form in ASP
Aug 03, 2012 03:17 PM|LINK
I create a program in C#, I try to make it to run directly from web page; Is it possible??? I'm very thankfully if you have any suggestion to help me
My Code
protected void Browse_Click(object sender, EventArgs e) { { openFileDialog1 ofd = new openFileDialog1(); if (ofd.showdialog()== true) openFileDialog1.FileName = ""; openFileDialog1.Title = "Choose a file to decrypt"; openFileDialog1.InitialDirectory = @"C:\"; string strFileToEncrypt = ""; string strOutputEncrypt = ""; string strExtension = ""; if (openFileDialog1.ShowDialog() == DialogResult.OK) { strFileToEncrypt = openFileDialog1.FileName; txtFileToEncrypt.Text = strFileToEncrypt; int iPosition; iPosition = strFileToEncrypt.LastIndexOf("."); if (iPosition == -1) { MessageBox.Show("Invalid file. Please select proper file."); } strExtension = strFileToEncrypt.Substring(iPosition, (strFileToEncrypt.Length - iPosition)); string strEncryptedExt = "z_z" + strExtension.Substring(1) + ".encrypt"; strOutputEncrypt = strFileToEncrypt.Replace(strExtension, strEncryptedExt); txtDestinationEncrypt.Text = strOutputEncrypt; btnFileEncrypt.Enabled = true; } } }AidyF
Star
9204 Points
1570 Posts
Re: How can use windows form in ASP
Aug 03, 2012 03:20 PM|LINK
Not that kind of app as it interacts with the desktop etc, but it runs on your server so who is going to see the dialogue boxes?
mkf
Member
7 Points
54 Posts
Re: How can use windows form in ASP
Aug 03, 2012 03:40 PM|LINK
Thanks for replay, I need to make this program to encrypt and decrypt file so it can run on both side but from web site instade from windows
markfitzme
Star
14471 Points
2236 Posts
Re: How can use windows form in ASP
Aug 03, 2012 04:36 PM|LINK
The best option is to take the code you would use to encrypt and decrypt and place it into it's own windows library project. This way the code compiles to a DLL that could be included in both applications. All that is required then is to write the UI that is required for each platform, and then when you hit submit handle the inputs and pass them to your encrypt/decrypt objects.
mkf
Member
7 Points
54 Posts
Re: How can use windows form in ASP
Aug 03, 2012 05:31 PM|LINK
can you explain that pleas, if can for my code or any example used windows form
ramiramilu
All-Star
95503 Points
14106 Posts
Re: How can use windows form in ASP
Aug 04, 2012 11:57 AM|LINK
do not call winforms controls from asp.net page....what you can do is that make such code which needs to run in moire trust and put it in silverlight...if you want to run that particular code on client side...
if you need some specific code to run on server, then you can think of windows services etc....rather than calling windows forms application form asp.net page...
Thanks,
JumpStart
mkf
Member
7 Points
54 Posts
Re: How can use windows form in ASP
Aug 04, 2012 12:55 PM|LINK
Thanks for reply, I want to explain that my project about encrypt file with password and then upload it in server, then when person need that file he will put the password and then the server will decrypt the file and start download... In fact I built the project in windows form but I need the program like a page instead of using program
Catherine Sh...
All-Star
23382 Points
2490 Posts
Microsoft
Re: How can use windows form in ASP
Aug 09, 2012 07:43 AM|LINK
Hi,
According to your description, you can try to do as follows:
For details about how to compile the .cs file into .dll file, please try command below:
csc.exe /t:lib /out:<Your DLL Name>.dllFor details about how to invoke the .dll file in the web page, please check the link below:
http://www.codeproject.com/Articles/19979/How-to-Use-a-DLL-as-a-Code-Behind-File
Best wishes,
Feedback to us
Develop and promote your apps in Windows Store