|
You'll have to find a computer that isn't behind your proxy. Do you run a DMZ? Or a web server? You can always try from someone's home.
I just googled the URI encoding and I got it right
http://en.wikipedia.org/wiki/URI_scheme[^]
Please let us know how you get on.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
And the games continue. My username for the SWIFT site is my password, which includes the @ sign. I got an error back saying that
a port # is expected because a colon was found in the request. I assume this is happening because of the @ in my username. Would I escape the @ character?
Mike Devenney
|
|
|
|
|
Not sure about that.
Have you tried putting the uri in a web browser?
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Before I was getting an error about having a colon in the request with no port specified. Now, I get this error from IE in a dialog box entitled Address Bar.
Windows cannot find
'https://mdevenney@wilmingtontrust.com:Password@www2.swift.com/bicdownload/bicdownloader?action=getfile&productline=bicdir&product=bicdb&content=full&format=txt&platform=win'. Check spelling and try again.
Mike Devenney
|
|
|
|
|
I don't know how to escape an @ in your username. I just tried putting the uri without username:password into ie8 and a dialog popped up asking for credentials. Could you try this, enter your credentials and see if you get the file?
If you do, it means your account and local network are working, which would narrow the problem down to the credentials your proxy is passing when you use WebRequest.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
I'm able to get the file using the URI and entering the credentials into the dialog that pops up. Is there any way to see what the proxy is passing?
Mike Devenney
|
|
|
|
|
You could try setting myReq.PreAuthenticate = true; Might work...
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Sounds like your idea of the proxy server interfering is a winner. I'm talking over my head here but I'll do my best to explain what I just learned. I spoke with two of our architects who said that any https requests have to spoof a validated certificate because our infosec dept strips out the remote host's certificate and inserts one of their own. I have some sample code that one of them uses for a web service that makes https requests. Because it's a web service the code is slightly different but it's the same idea...
ServicePointManager.ServerCertificateValidationCallback
+= new RemoteCertificateValidationCallback(ValidateRemoteCertificate)
private static bool ValidateRemoteCertificate
(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors policyErrors)
{
return true;
}
By "faking" the true value for the ValidateRemoteCertificate method the authentication succeeds and the connection will open successfully. I'm off to work this into my routine. If/when I get it working I'll post the "correct" code. Thanks for helping me work through this!
Mike Devenney
|
|
|
|
|
GAH
Thought that the certificate was going to be the silver bullet but I still get my now least favorite response: The server returned an error: (401) Unauthorized. I'm headed back to the drawing board. Not defeated yet, but getting there.
Mike Devenney
|
|
|
|
|
Hi guys
How can i Create buttons dinamyclly?
i want to add 20 buttons for example.
I tried to use an array and put all needed properties in a for loop but it is not working.
i think i forgot something
|
|
|
|
|
Show us what you have already then
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
for(int i=0;i<20;i++)
{
Button buttonName = new Button();
buttonName.property = property;
this.Controls.Add(buttonName);
}
Enjoy, add delegates for events!
|
|
|
|
|
thats exactly what i forgot
this.Controls.Add(buttonName);
thanks!
|
|
|
|
|
In the above example how would you modify the button's location in C#
for (int i = 0; i < 20; i++)
{
Button buttonName = new Button();
buttonName.Location.X = i * 20;
this.Controls.Add(buttonName);
}
When I try this I get an error message
Cannot modify the return value of 'System.Windows.Forms.Control.Location' because it is not a variable
I think I should have created an array of button pointers, but I can't remember how.
Thanks in advance
|
|
|
|
|
Just change
Douglas Kirk wrote: buttonName.Location.X = i * 20;
to
buttonName.Location = new Point(i * 20,whatever_you_want_as_y);
and you're done.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Hi,
if you know how to do things in Visual Designer (say position a button), then you can watch the code it generates (for a form myForm that would be in the InitializeComponents method inside file myForm.designer.cs).
So there is no magic involved, you can try and put similar code where ever you want, be it in the Form's constructor, load handler, a button click handler, you choose.
Apart from that, it helps to look up things in the documentation (use google to locate stuff) and to interpret compiler messages to the letter.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I'm editing an existing library of user controls and I must admit, my experience is limited. These user controls are a combination of other user controls, mainly buttons and and panels. They where created to mimic the companies existing controls used in webapps for our desktop applications. Simple, and it works but they where initially designed for limited scalability.
So now the requirement emerges that each control should be resizable without altering the relative position of controls, some of which are transparent. I'm implementing this by, what appeared to be the easy task of reordering controls in the document outline and editing each controls dock and padding properties, which worked fine for a couple of controls.
Now I have the following outline: (control names reduced to simplicity to avoid confusion)
|---UserControl
|---Panel1
|---Panel2
|---Panel3
|---Button1
|---Button2
|---Button3
I dock Panel1 to DockStyle.Fill to the Parent UserControl to ensure that the control is resizable for obvious reasons, My problem is Panel2, which is overlayed on Panel1 by 6 pixels from the left and right respectively, I wish to keep this same fixed distance from the parent despite resizing, so I set dock to Fill and padding for left and right to 6 each, figuring this would work. It doesn't, which makes me feel I misunderstand the usage of Padding to begin with.
Any suggestions on where I went wrong and what would be the proper usage to enable this resizable implementation work as intended?
Sorry for weak explanation / poor ASCII art.
|
|
|
|
|
If you look into the anchor property instead of dock. that will do what you want and keep the 'indent'. Problem with the anchor is it may not work how you want it to if you have a lot of controls in the same control. i.e. 3 panels that need to have a 3rd of the form space each can not be handled with either dock nor anchor - that would need to be done manually on a resize event.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Been trying, haven't had any luck. Any other suggestions? I want to fill but preserve a 6 pixel distance from the parent control (from the left).
|
|
|
|
|
anchor will def do it for that.
make sure the control has dock set to 'none'
then...
myControl.Anchor = AnchorStyles.Right | AnchorStyles.Left| AnchorStyles.Top| AnchorStyles.Bottom;
this will keep the control to fill but with the same distance from each side of its parent control as it was when first created.
if it don't work then you have some other issue stopping it working but i'm afraid i must leave the net for the time being. good luck
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Got it, anchors where set already causing my dock to act weird, but i got it.
Thanks for the help
|
|
|
|
|
I'm lookin for a design-pattern that match what I need: I have class A which should hold a collection of class B or its inehrited classes. class B should be able to run functions and access properties on A and A should be able to run functions and access properties on B.
I've been suggested to pass reference of As properties to B opon construction, but I'm lookin for the design-pattern...
anyone know of any design-pattern similar to this?
Thanks alot
NaNg.
|
|
|
|
|
It's called the Charlie Foxtrot design pattern.
|
|
|
|
|
are you sure? (or are you just teasing me?) :x
I can't find in google some info about it.
Can you maybe give me a link for more info about it?
|
|
|
|
|
The word gullible is written on your ceiling. Check it out.
|
|
|
|