Click here to Skip to main content
15,889,116 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Asp.net bank transfer Pin
Otekpo Emmanuel14-Jan-14 5:19
Otekpo Emmanuel14-Jan-14 5:19 
GeneralRe: Asp.net bank transfer Pin
Ron Beyer14-Jan-14 5:27
professionalRon Beyer14-Jan-14 5:27 
AnswerRe: Asp.net bank transfer Pin
jkirkerx14-Jan-14 13:49
professionaljkirkerx14-Jan-14 13:49 
GeneralRe: Asp.net bank transfer Pin
Otekpo Emmanuel14-Jan-14 16:31
Otekpo Emmanuel14-Jan-14 16:31 
GeneralRe: Asp.net bank transfer Pin
jkirkerx14-Jan-14 17:14
professionaljkirkerx14-Jan-14 17:14 
QuestionMessage Closed Pin
12-Jan-14 4:12
sifars12-Jan-14 4:12 
QuestionRe: Error in code Pin
Richard MacCutchan12-Jan-14 5:29
mveRichard MacCutchan12-Jan-14 5:29 
QuestionError in code Pin
sifars11-Jan-14 20:57
sifars11-Jan-14 20:57 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Security.Cryptography;
using System.Drawing;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button2_Click(object sender, EventArgs e)
{
RSACryptoServiceProvider myrsa = new RSACryptoServiceProvider();
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();

openFileDialog1.Title = "Insert Image";
openFileDialog1.ShowDialog();
openFileDialog1.Filter = "JPEG Images|*.jpg|GIF Images|*.gif";

//object r = new object();
EventArgs en = new EventArgs();

string s1 = richTextBox1.Text;
string s2 = richTextBox2.Text;
string s3 = richTextBox3.Text;

string Chosen_File = "";
Chosen_File = openFileDialog1.FileName;
pictureBox1.Image = Image.FromFile(Chosen_File);

byte[] byteData = imageToByteArray(pictureBox1.Image);
string ToS1 = byteData.ToString();

Byte[] newdata = encoding.GetBytes(ToS1);
Byte[] encrypted = myrsa.Encrypt(newdata, false);

for (int i = 0; i < encrypted.Length; i++)
richTextBox4.Text += encrypted[i].ToString();

Byte[] decrypted = myrsa.Decrypt(encrypted, false);//decrypt
pictureBox2.Image = byteArrayToImage(decrypted);


}
public byte[] imageToByteArray(System.Drawing.Image imageIn)
{
MemoryStream ms = new MemoryStream();
imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
return ms.ToArray();
}

public Image byteArrayToImage(byte[] byteArrayIn)
{
MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;
}

}

}

Problem in Code :: When we decrypt the image back then it shows an error in "Image.FromStream(ms): during run time.
AnswerRe: Error in code Pin
Richard MacCutchan11-Jan-14 22:13
mveRichard MacCutchan11-Jan-14 22:13 
QuestionAfter converting MVC 4 project to MVC 5 I am getting an error "this website has redirect loop" Pin
Code10811-Jan-14 11:56
Code10811-Jan-14 11:56 
Questionscrolling webpage asp.net (C#) Pin
Member 947380911-Jan-14 11:50
Member 947380911-Jan-14 11:50 
QuestionRe: scrolling webpage asp.net (C#) Pin
Richard Deeming13-Jan-14 1:58
mveRichard Deeming13-Jan-14 1:58 
AnswerRe: scrolling webpage asp.net (C#) Pin
Member 947380913-Jan-14 8:52
Member 947380913-Jan-14 8:52 
GeneralRe: scrolling webpage asp.net (C#) Pin
Richard Deeming13-Jan-14 9:13
mveRichard Deeming13-Jan-14 9:13 
QuestionRe: scrolling webpage asp.net (C#) Pin
Member 947380913-Jan-14 22:31
Member 947380913-Jan-14 22:31 
AnswerRe: scrolling webpage asp.net (C#) Pin
Richard Deeming14-Jan-14 1:30
mveRichard Deeming14-Jan-14 1:30 
Questiondoubt Pin
Member 1051704210-Jan-14 16:49
Member 1051704210-Jan-14 16:49 
AnswerRe: doubt Pin
Richard MacCutchan10-Jan-14 22:15
mveRichard MacCutchan10-Jan-14 22:15 
AnswerRe: doubt Pin
Marco Bertschi11-Jan-14 11:17
protectorMarco Bertschi11-Jan-14 11:17 
QuestionChanging Target framework from .net 2.0 to .net 4.5 Pin
indian14310-Jan-14 8:46
indian14310-Jan-14 8:46 
AnswerRe: Changing Target framework from .net 2.0 to .net 4.5 Pin
Marco Bertschi11-Jan-14 11:22
protectorMarco Bertschi11-Jan-14 11:22 
GeneralRe: Changing Target framework from .net 2.0 to .net 4.5 Pin
Prabhu S M12-Jan-14 19:50
Prabhu S M12-Jan-14 19:50 
GeneralRe: Changing Target framework from .net 2.0 to .net 4.5 Pin
Marco Bertschi12-Jan-14 20:31
protectorMarco Bertschi12-Jan-14 20:31 
QuestionReg: To help for Asp.net Pin
sachin 1129-Jan-14 2:03
sachin 1129-Jan-14 2:03 
AnswerRe: Reg: To help for Asp.net Pin
Tom Marvolo Riddle9-Jan-14 17:58
professionalTom Marvolo Riddle9-Jan-14 17:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.