|
Hello Everyone,
I am trying to access a page which is secure behind a login system. I do have credentials, but I am trying to automate this as I have to download this page every month.
When I try to use HTTPWebRequest, it doesn't works. I tried to investigate this using Fiddler as well, and here is the log:
Protocol Host URL
HTTP TUNNEL to subdomain-x.site.com/needed-page.html <- My request
HTTP TUNNEL to subdomain-y.site.com
:
.
HTTPS subdomain-y.site.com some-url
What I am trying is:
1. Create Web Request
2. Create Cookie Container
3. Create Network Credentials
4. Create Headers
5. Get Response
However, this returns the Login Page itself. Any help will be highly appreciable.
|
|
|
|
|
Impossible to say with the info you've given. You need to analyze the login page source code to see how the credentials are sent back to the server and how the actual page you want to access is authenticated. If its just a random SSL page, you just need to fill in the HTTPWebRequest.Credentials object.
|
|
|
|
|
Hi All,
Could you please assist me in saving and retrieve images to MySQL database using an Image Path.
Let me know, if you require any additional information to assist me.
Thank you,
Nirmal
|
|
|
|
|
You need to explain what assistance you need. If you want to save the actual image, then save it as a byte stream or blob (whatever is the MySQL equivalent). If you want to save the file's location then it is just a character string.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Thank you for your response.
I am saving the image as LongBlob. But retrieving an image through search function, i get parameter not valid error.
byte[] bytesofphotosretrive;
bytesofphotosretrive = (byte[])r["photo"];
MemoryStream mst = new MemoryStream(bytesofphotosretrive);
{
frm1.pictureBox5.Image = Image.FromStream(mst);
}
Please assist.
Regards,
Nirmal
|
|
|
|
|
nirmalgopalakrishnan wrote: i get parameter not valid error. Where?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
byte[] bytesofphotosretrive;
bytesofphotosretrive = (byte[])r["photo"];
MemoryStream mst = new MemoryStream(bytesofphotosretrive);
{
frm1.pictureBox5.Image = Image.FromStream(mst);
}
the error points to this parameter : frm1.pictureBox5.Image = Image.FromStream(mst);
|
|
|
|
|
Well it should not be too difficult to guess which parameter is in error. Use your debugger to step through the code and see exactly what is happening.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
It's pointing to the error in line 164, which is as below:
frm1.pictureBox5.Image = Image.FromStream(mst);
The exception message is: "System.Argument.Exception: Parameter is not valid. at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData) at System.Drawing.Image.FromStream(Stream stream)at btnResearch_Click(Object sender, EventArgs e) in D:\Mat\frmRecSearch.cs: line 164.
|
|
|
|
|
Well we already know that. Have you used the debugger to try and determine why the parameter is invalid?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Could you please email me. nirmalkumarg3@gmail.com
|
|
|
|
|
Sorry no, if you have issues to discuss around this problem then post them in this forum; that is why we use it.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Cool, no issues. It points to a null parameter in the debugger. But the same code, when executed with just an image add and retrieve (a new c# project), the application works really well. I am unable to determine what is the problem here
|
|
|
|
|
nirmalgopalakrishnan wrote: I am unable to determine what is the problem here From a previous post you have the following code:
byte[] bytesofphotosretrive;
bytesofphotosretrive = (byte[])r["photo"];
MemoryStream mst = new MemoryStream(bytesofphotosretrive);
{
frm1.pictureBox5.Image = Image.FromStream(mst);
}
So you need to find out why mst is null at this point. Your code is assuming that you always get a valid byte array from r (whatever that is), and hence a valid stream. However, if either of these commands do not return the expected result you are going to have a problem which you are not catering for. You should never assume that method calls like this will always succeed; add some error checks so you can diagnose it properly when it fails.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
|
Thank you for your response. The link which you provided was really helpful. But i am not sure how to include the same in my application, since i am saving data from 15 text boxes.
I am confused as to where to include the image details.
Regards,
Nirmal
|
|
|
|
|
I have a form that has an array of text boxes dynamically added to a splitcontainer on a form. I use the same array to add text boxes to the form twice (different data for different table). I would like to use an event handler, preferably once, to change background color to yellow when textbox[i] receives focus, and back to white when it loses focus. I am currently going around in circles. Can anyone help me? Thanks for your input
Everett
|
|
|
|
|
Add in a lambda, at the point where you create the textboxes. Like the example below;
public Form1()
{
InitializeComponent();
var tb = new TextBox();
tb.GotFocus += delegate (object s, EventArgs a)
{
(s as TextBox).BackColor = Color.Red;
};
tb.LostFocus += delegate(object s, EventArgs a)
{
(s as TextBox).BackColor = Color.Green;
};
Controls.Add(tb);
}
|
|
|
|
|
hi, your idea is right, but the textbox has't the event GotFocus & LostFocus, instead of, has the event Enter & Leave.
|
|
|
|
|
Works beeeautiful. Thank you so much Eddy
Everett
|
|
|
|
|
I am rewriting a desktop application in VS2010 that was written in .Net 1.1. While doing so, I decided to add a couple of features to the app. One is a data source for a drop down list. I am using a local database file (.sdf) for the data.
I noticed in the <namespace>.Properties.Settings file that the connection string is a hard link to where I entered the file location (which is C:\Users\<username>\Documents\db\<filename>). I need this to be more dynamic, due to the fact this app will be on many different computers.
I tried editing to :
"Data Source = " + System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + @"\dbs\latefee.sdf")]
But I receive the following error at compile time:
Error 1 An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type C:\Users\brian\AppData\Local\Temporary Projects\latefeedisc\Properties\Settings.Designer.cs 29 68 latefeedisc
How do I correct this?
Thank you in advance.
Jude
|
|
|
|
|
Didn't you read the warning at the top?
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.544
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
??
You aren't supposed to modify that file. You should set the property in the constructor of your window.
|
|
|
|
|
TheJudeDude wrote: I need this to be more dynamic
More dynamic than a settings-file?
|
|
|
|
|
I apologize for my ignorance.
Jude
|
|
|
|
|
Don't. It wasn't "ignorant", just overlooked some semantics that "could" give a hint.
It's a real settings-file; now, if only the database-name (or path) is going to differ, it'd might be neat to use a connection-string with a literal set of characters in the place where the databasename should be, and to Replace the literal with the actual path just before using the string.
|
|
|
|