|
Hey,
is there a thing to do httpwebrequest trought a socks 5 proxy ?
Sorry for my english :-S
Regrads
|
|
|
|
|
There's no direct support inside HttpWebRequest to achieve this. You might want to use an alternate method instead. Take a look at this[^] for a solution.
|
|
|
|
|
how to resize a image inside a preview panel using c#..the image should be highlighted in the panel preview box...when it is clicked in the list view box..kindly help me for my answer
|
|
|
|
|
Please be more specific on what have you tried so far and where exactly you are stuck and need help with.
Steps:
1. Have image list (list view)
2. Define handler for onclick of list items
3. Have preview panel box displayed
4. Show the item selected with defined height & width in preview panelbox.
|
|
|
|
|
k i wil say clearly..........i hav added an image in panel preview box..it is displayed in list view also......after i made selection in list view...i must move the image with mouse pointer and must resize the image with mouse pointer...............
|
|
|
|
|
Hi, so I'm having trouble with my coding. I've already figured out for to take money from Tom and Rob, but i can't figure out how to deposit that value into the bank. here's what i have so far.
I would really appreciate it if, someone would take a look.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Lab05_E00995877
{
public partial class Form1 : Form
{
//Add your form1 variables
Person Tom;
Person Rob;
decimal bank = 50M;
public Form1()
{
InitializeComponent();
//Initialize (create) Tom and Rob
Tom = new Person();
Tom.Name = "Joe";
Tom.Cash = 150M;
btnGetOne.Text = "Get from " + Tom.Name;
Rob = new Person();
Rob.Name = "Bob";
Rob.Cash = 200M;
btnGetTwo.Text = "Get from " + Rob.Name;
UpdateForm();
}
public void UpdateForm()
{
lblFirstName.Text = Tom.Name;
lblMoneyOne.Text = Tom.Cash.ToString();
lblSecondName.Text = Rob.Name;
lblMoneyTwo.Text = Rob.Cash.ToString();
lblMoneyBank.Text = bank.ToString();
}
private void btnGetOne_Click(object sender, EventArgs e)
{
decimal decAmount, decTomAmount, decRobAmount, decBankAmount;
try
{
decAmount = Decimal.Parse(txtMoney.Text);
decTomAmount = Decimal.Parse(lblMoneyOne.Text);
decRobAmount = Decimal.Parse(lblMoneyTwo.Text);
decBankAmount = Decimal.Parse(lblMoneyBank.Text);
//bankamount (bank) Amount punched in (decAmount)
if (decTomAmount >= decAmount)
{
decTomAmount -= decAmount;
lblMoneyOne.Text = Tom.ReceiveCash(decAmount).ToString();
lblMoneyBank.Text = bank.ToString();
//What do i put here to add to bank after subtracting from Tom?
UpdateForm();
}
else
{
MessageBox.Show("Tom doesnt have this many!");
}
txtMoney.Clear();
txtMoney.Focus();
}
catch
{
MessageBox.Show("Please enter numbers only!");
txtMoney.Clear();
txtMoney.Focus();
}
}
private void btnGetTwo_Click(object sender, EventArgs e)
{
decimal decAmount, decTomAmount, decRobAmount;
try
{
decAmount = Decimal.Parse(txtMoney.Text);
decTomAmount = Decimal.Parse(lblMoneyOne.Text);
decRobAmount = Decimal.Parse(lblMoneyTwo.Text);
//bankamount (bank) Amount punched in (decAmount)
if (decRobAmount >= decAmount)
{
decRobAmount -= decAmount;
lblMoneyTwo.Text = Rob.ReceiveCash(decAmount).ToString();
lblMoneyBank.Text = bank.ToString();
//What do i put here to add to bank after subtracting from Rob?
UpdateForm();
}
else
{
MessageBox.Show("Rob doesnt have this many!");
}
txtMoney.Clear();
txtMoney.Focus();
}
catch
{
MessageBox.Show("Please enter numbers only!");
txtMoney.Clear();
txtMoney.Focus();
}
}
}
}
This is the other part defining the class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Lab05_E00995877
{
class Person
{
public string Name;
public decimal Cash;
public decimal GiveCash;
public decimal ReceiveCash(decimal amount)
{
if (amount > 0)
{
Cash -= amount;
return Cash;
}
else
{
MessageBox.Show(amount + " isnt an amount I'll take",
Name + " says..");
return 0;
}
}
}
}
modified 21-Feb-13 0:20am.
|
|
|
|
|
Jimmy1734 wrote: //What do i put here to add to bank after subtracting from Tom?
bank += decAmount; ..but then again, how would you track that it's Toms' money? How much of those 50M belongs to Tom, and how much belongs to Rob?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
i am new in this encoding decoding stufs and i have some problem.
I work on VS 2012 ASP.NET c#.
My problem is that i need to create CheckSum value from some input string. The length of the CheckSum need to be 16 bytes (32 characters) long like this one: "8A303F3E0CB4F8A9CDA5AC120F9B90A4".
The encryption need to be done using a pass key for example TEST_PASS and this key will be used latter to be decrypted this hash value....
hope you understand what i ask and what i need pls help me
|
|
|
|
|
You can hash, but you can't dehash.
|
|
|
|
|
Look again at the specs for encryption/decryption. That looks trather like a multistep step procedure:
- user enters password
- system generates salt
- system generates hash from salted password and derives both CheckSum and actual password for encryption
- system stores salt and CheckSum in the encrypted file
- system encrypts input file with the actual password generated above.
When you want to decrypt the file, you can check the password by calculating the CheckSum. The decrpytion algorithm might work with a wrong password too, just producing a nonsense output...
|
|
|
|
|
First, MD5 is a cryptographics HASH, NOT an encryption.
Second, it's a ONE-WAY hash. There is no such thing as "decrypting a hash". In theory, you cannot get the original content back from a hash value.
Lastly, MD5 is considered broken and should no longer be used in production code. It just doesn't take that much computing power to break it in todays world. Also, two different pieces of content CAN produce the same hash value using MD5!
Use something a bit stronger, like SHA512 instead and use proper salting techniques to make it even harder to break.
|
|
|
|
|
Hello,
Below is a piece of code, where in I am trying to post a file from my pc to remote development server. For some reason it does not seem to be working. I don't see the file on the remote server.
private void button2_Click(object sender, EventArgs e)
{
FileStream filetoupload = new FileStream("C:\\projects\\testfile.csv", FileMode.Open);
Uri address = new Uri("http://devsrvr/hints/");
HttpWebRequest webreq = HttpWebRequest.Create(address) as HttpWebRequest;
webreq.Method = "POST";
webreq.ContentType = "application/x-www-form-urlencoded";
webreq.Timeout = 15 * 1000;
byte[] bytedata = UTF8Encoding.UTF8.GetBytes(filetoupload.ToString());
webreq.ContentLength = bytedata.Length;
try
{
using (Stream poststream = webreq.GetRequestStream())
{
poststream.Write(bytedata, 0, bytedata.Length);
}
MessageBox.Show("done!!");
}
catch (Exception ex)
{
ex.InnerException.ToString();
ex.Source.ToString();
ex.Message.ToString();
}
}
|
|
|
|
|
Change your catch to something like below and try again;
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
It is not going into the catch part at all.
There are no errors in the program.
|
|
|
|
|
vanikanc wrote: There are no errors in the program. There is, even though it doesn't throw an exception. Consider below line;
byte[] bytedata = UTF8Encoding.UTF8.GetBytes(filetoupload.ToString());
"filetoupload.ToString()" would result in "System.IO.FileStream". And that'd be passed to the "GetBytes"-function. Try something like below;
byte[] bytedata = File.ReadAllBytes("C:\\projects\\testfile.csv");
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I tried what you suggested, that did not work. The program was not responding. Thank you for suggesting. I will continue to dig deeper.
|
|
|
|
|
I'm not surprised it's not working. As a small point, could you please post code that stands a chance of compiling. There isn't a HttpWebRequest.Create - it's WebRequest.Create.
Your problem here is that you are just reading the data into a stream, which you then dispose of. What do you think the stream at the server end is going to do? You actually need something there to take that stream and write it out to a file. That's the part you're missing here.
|
|
|
|
|
Actually, using HttpWebRequest.Create I was able to download a file from remote server to a specified location.
Now, I want to be able to upload a file to a remote server using
HttpWebRequest.Create( .
The code works using WebClient class, to upload and download files, but there is not much error trapping that could be coded for. On research the better option was to use
HttpWebRequest .
Having an issue trying to post a file
|
|
|
|
|
source code for navigation
|
|
|
|
|
First, and foremost, we're not in the business of just handing over code on demand.
Second, navigation of what?? Driving a car via GPS? A boat perhaps? Something in a WPF app? Menus in a Windows Forms app? a ASP.NET app?
|
|
|
|
|
Quote: Second, navigation of what?? Driving a car via GPS? A boat perhaps? Something in a WPF app? Menus in a Windows Forms app? a ASP.NET app might be a Space Shuttle navigation?
|
|
|
|
|
Soo many choices, soo little time to list them all...
|
|
|
|
|
Hello Guys,
Hope you are doing good.
I am developing a Designing Application. In this application there is a feature where user can add multiple images on form(can drag here and there).
I have few GIF Images of Cartoons. I want to show them as GIF Only. But when I put image on form it shows White area in blank portion.
I have used Panel and Images are set as Background Image in the Panel.
I think I have not described clearly. Here I have attached image link for more clarification.
In this image background is a Panel(pnlMain) with a Background image. And Spider man is in another panel (panel1) with Background Image in panel1. Spider man image is GIF Image with Transparent area around spider man.
Image is here in this link.http://www.evernote.com/shard/s263/sh/8afc9a41-2a22-4a46-9703-33b77bb93f11/c1ecd6fb6a2ec44f6ac324e6482c4e6e[^]
I appreciate your cooperation.
-Ishrar G.
|
|
|
|
|
|
Hi,
I made simple winform application in C#. I am showing menu options depending upon the mode selection. .i.e. if mode is eng then I am showing all the menus in MDI and if mode is tech then I am hiding some menus of MDI.This is handled in Code.
I am using MSI to create setup.I am using custom dialog box i.e. 2 radio button for mode selection. Now I want install software depeding upon the mode selection. i.e. if I select Eng mode radio button then installer install software with all menus and if I select tech mode then installer install only few menus which is applicable to tech mode.
I dont know how to use custom action so that i can pass the selection option to the exe.
Is there any other solution just let me know.
Thanks,
sjs4u
|
|
|
|