|
Hi,
don't serilize it directly to a file. First serialize it into a MemoryStream. Then put that one into a CryptoStrem (this article should give you the basic idea on how to use it). The output of that one can then finally be written to a file (FileStream class).
If you use the cryptographic classes correctly it will be very hard to nearly impossible for someone else to decrypt it.
|
|
|
|
|
Hi, tnx for your advise, but just one consideration:
if i use these lines in my code
cryptic.Key = ASCIIEncoding.ASCII.GetBytes(“ABCDEFGH”);
cryptic.IV = ASCIIEncoding.ASCII.GetBytes(“ABCDEFGH”);
it can be get in back by hackers opening my application in assembly code or just if it crash for whatever cause.
Isn't it?
My trouble is can someone got these keys? so use to decrypt manually the stream?
|
|
|
|
|
This is the problem facing everyone, and there is no way around it. There are numerous ways to make it harder for someone to get the keys, but ultimatley if you want to encode and decode from within your program then you will be susceptible to the problems you mentioned.
However, if the user is entering the key/password then it's a different matter entirely, and you can make it very secure.
|
|
|
|
|
I'M TRYING TO BUILD A WEBSITE WITH A DOWNLOAD PAGE.
BUT THE PROBLEM IS; I NEED TO CREATE A CODE FOR THE LINK, ONCE THE CUSTOMER PURCHASES THE PRODUCT AND PAYMENT IS COMFIRMED THEY THEN GO TO THE DOWNLOAD PAGE.
BUT, I DON'T UNDERSTAND HOW TO BUILD THAT CODED DOWNLOAD PAGE LINK, I'M WAY OVER MY HEAD ON THIS ONE.
CAN ANYONE HELP ME BUILD THAT CODED DOWNLOAD LINK? I'M SO CONFUSED.
I DON'T UNDERSTAND THIS CODE WRITTING STUFF,
THIS IS MY FIRST TIME AND I NEED A LOT OF HELP.
PLEASE CAN ANYONE HELP ME? PLEASE.
IT'S SO HARD I DON'T UNDERSTAND...
????
|
|
|
|
|
STOP SHOUTING
dontunderstand wrote:
I DON'T UNDERSTAND THIS CODE WRITTING STUFF,
THIS IS MY FIRST TIME AND I NEED A LOT OF HELP.
I'm sorry so many people voted without giving you advice. My advice, you shouldn't do anything that will be seen in the real world for your first project. You should take the time to learn some stuff first.
A really simple way to do this is with a response.redirect statement in your page when payment is confirmed, which goes to either the zip ( which will start a download ), or the page with the zip ( which you can hide from google, but which someone will hand out, or discover, eventually. You should password protect your zip and send the password as another line of defence and a way to get your clients email addresses ( don't sell them or spam them, but do use them to send info on updates, etc. )
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Suppose I have this:
public Pen[] activePen = new Pen[] { new Pen( Color.Blue ), new Pen( Color.Green ), new Pen(Color.Red) };
How to infinitely cycle through the 3 Pens?
thanx
|
|
|
|
|
Like this?
int i = 0;
while (true) {
i = i % 3;
Pen nextPen = activePen[i];
i++;
}
|
|
|
|
|
That works-thanks-- but I have one Pen array for the form and
several different g.DrawLine calls to put a few different colored
lines on the form due tied to text boxes --- thanks again
|
|
|
|
|
Well you don't need the while loop. Instead make a private member out of i and put call this method to get a Pen:
private int _penIndex = -1;
private Pen GetNextPen() {
_penIndex = (_penIndex + 1) % 3;
return activePen[_penIndex];
}
|
|
|
|
|
HI, I WAS WONDERING IF YOU KNOW HOW TO WRITE A CODE TO A DOWNLOAD PAGE?
IF SO CAN YOU PLEASE HELP ME?
I JUST DON'T UNDERSTAND HOW TO DO IT...
dontunderstand
|
|
|
|
|
I have code that will draw a line on a form. When I hard code it to draw the line it works fine, meaning every time
the form launches a line is drawn. Now i want to set a bool flag and pass it in as a conditional statement to drawn the
line when the Button1 is clicked. I know I'm missing something obvious.
public class Form1 : System.Windows.Forms.Form
{
//Member fields.
private bool drawLine1 = false;..............etc
///////////////////////////////////////////////////////////////////////////
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
if(drawLine1) //DRAW LINE 1 IS ALWAYS FALSE.....
DrawComplexNumber(e.Graphics);.............etc
//////////////////////////////////////////////////////////////////////////
private void Button_1OK_Click(object sender, System.EventArgs e)
{
drawLine1 = !drawLine1;
Invalidate();
}
How do I fix it? Please -- need a "nuts and bolts" answer, not an "abstract" explanation. Thanks a lot in advance....
|
|
|
|
|
The code seems to be ok but I noticed that your button click eventhandler has a strange name. You should probably check if the click event of the button is really bound to that method.
Just check (eg by setting a brakepoint) if the drawLine1 = !drawLine1 is being hit and if drawLine1 has the correct contents afterwards.
Then check if you prpbably set drawLine1 back to false somewhere else in your code. Doing some Console.WriteLine("DrawLine1: " + drawLine1.ToString()) here and there should also help you to trace down the problem.
Hope you don't feel this answer is abstract but if you test this code in an empty form you will see that it works and that the error must come from somewhere else.
|
|
|
|
|
You were absoutely right. Thought I was going nuts-- thanks
works fine now
|
|
|
|
|
Try out this code as an example -
public class Form1 : System.Windows.Forms.Form<br />
{<br />
private System.Windows.Forms.Button button1;<br />
private bool drawline = false;<br />
private int radius = 25;<br />
private int green = 10;<br />
private int red = 10;<br />
private int blue = 10;<br />
}<br />
<br />
<br />
private void Button_1OK__Click(object sender, System.EventArgs e)<br />
{<br />
drawline = !drawline;<br />
Random r = new Random(100);<br />
Int32 x = Int32.Parse(r.Next().ToString().Substring(1,2));<br />
Int32 y = Int32.Parse(r.Next().ToString().Substring(1,3));<br />
<br />
if (green < 230)<br />
green += 10;<br />
<br />
if (blue < 230)<br />
blue += 10;<br />
<br />
if (red < 230)<br />
red += 10;<br />
<br />
if (drawline)<br />
{<br />
System.Drawing.Graphics g = this.CreateGraphics();<br />
Point P = new Point(x,100);<br />
Point p1 = new Point (100,y);<br />
Color j = Color.FromArgb(red,green,blue);<br />
Pen Pe = new Pen(j);<br />
<br />
g.DrawEllipse(Pe,x,x ,radius, radius);<br />
radius += 20;<br />
}<br />
else<br />
{<br />
System.Drawing.Graphics g = this.CreateGraphics();<br />
Point P = new Point(x,100);<br />
Point p1 = new Point (100,y);<br />
Color j = Color.FromArgb(red,green,blue);<br />
Pen Pe = new Pen(j);<br />
<br />
g.DrawEllipse(Pe,y,y ,radius, radius);<br />
radius += 20;<br />
this.Refresh();<br />
}<br />
}
Regards
Mahesh
|
|
|
|
|
Is there a property build for a DataGrid in a C# Windows Application?
I have used this feature when building web applications, but it does not appear to be present as I am building a Windows application and want to do a basic layout for my datagrid without manually constructing the data columns and features.
Thanks.
SD
|
|
|
|
|
The WinForms DataGrid is really inflexible if you're used to using the asp:DataGrid control. I'm afraid you're going to have to manually construct the stuff you want.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
Thanks...I was afraid of that.
William
|
|
|
|
|
Hi all
I want to make a user defined control which combine a textbox and DateTimepicker. I write the following code for the Resize event
Size wholesize = this.Size;
int x = wholesize.Width;
wholesize.Height = 21;
Point location = new Point(x - 20, 21);
this.calendar.Location = location;
Size newsize = new Size(wholesize.Width-20, 21);
this.textbox.Size = newsize;
But this code doesn't work, could anybody tell me how to redraw the user control, when I resize it???
Thanks in advance!
Asura
|
|
|
|
|
Hmmm... you give us some code which you say doesn't do what you want it to do. But you also don't describe what you exactly want to do... Are we going to guess what you want?
You'll have to explain a bit more if we should help you. But here is a more general tip:
Instead of calculating the new sizes yourself you should use the docking and/or anchoring mechansims of .Net controls. If you want a DateTimePicker at the top and a TextBox filling out the rest of the control you would assign DockStyle.Top to the Dock property of the DateTimePicker and DockStyle.Fill to the TextBox.
Note that when using docking the order of the controls in the form are relevant (and can be changed via the designer).
|
|
|
|
|
Guys,
I need your help..
I need to modify the difficulty level of the lunar lander game..
is it possible to change the dy to .5?? is there any better suggestions in here??
private void timer1_Tick(object sender, System.EventArgs e) {
//code that should happen on every timer tick (10 times/sec)
//account for gravity
dy+= .5;
//increment score for being alive
score += 100;
//show ordinary (no flames) lander
picLander.Image = myPics.Images[0];
moveShip();
checkLanding();
showStats();
} // end timer tick
thanks...
|
|
|
|
|
What implementation of this game are you referring to?
But yes, in general it helps just raising the gravity to make it harder.
|
|
|
|
|
hello,
i have a panel which i draw stuff on using the DrawPolygon method of the Graphics object. i have a collecition of Building objects. each building object has an array of points associated with it. On the paint event of the panel object, i iterate through all the buildings and draw them one by one.
the question is, 1) how do i know if the mouse is within the bounderies of one of the building?
2) i use the transformation matrix to zoom in to the drawing. will the answer to number 1 work when i zoom in?
thanks,
michael
|
|
|
|
|
Hi!
When I start remote host as the service, it stops giving me the messsage that the service has got no work.Please help if anybody has idea about this.
Akshay
|
|
|
|
|
can anyone help me.I get problems with DataGrids not firing their PageIndexChanged event.Here is code which i m trying:
private void DataGrid1_OnPageIndexChanged(object sender,System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
DataGrid1.DataSource = oDv;
DataGrid1.DataBind();
}
|
|
|
|
|
What's the difference between a struct and a class? why should i use a struct?
|
|
|
|