|
I am trying to write a script that can download a batch of PDF files from a site that requires users to login first. To login, I used the following code:
Dim objIE As New InternetExplorer<br />
<br />
objIE.Visible = True<br />
objIE.Navigate sURL<br />
<br />
Do<br />
DoEvents<br />
Loop Until objIE.readyState = READYSTATE_COMPLETE And objIE.Busy = False<br />
<br />
objIE.Document.all("username").Value = sUserName<br />
objIE.Document.all("password").Value = sPassword<br />
objIE.Document.forms("loginForm").Submit<br />
<br />
objIE.Navigate somefile.pdf
I am stuck after this point.
I cannot use:
objIE.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_DONTPROMPTUSER
because it saves the file as text with a bunch of header info and binary contents corrupted.
I tried using
URLDownloadToFile(0&, somefile.pdf, sLocalFileName, 0&, 0&)
but this doen't work either because the request is not authenticated (the request returns the login page). The server doesn't support basic authentication, by the way
I think the answer is in the first parameter of URLDownloadToFile. If I can somehow pass the reference to the Internet Explorer object, the authentication info should, in theory, carry over. I haven't been able to find anything on the Web to help me with this, however.
Any thoughts?
Any alternatives?
Thank you.
A reasonable man adapts himself to the world. An unreasonable one persists, trying to adapt the world to himself. That is why all the progress in the world depends on the unreasonable men.
|
|
|
|
|
Hi,
In my project,i am having many .aspx pages
i am calling web methods from my each .aspx page separately.
In one of the form, my page_load event is firing.
After putting break point also, the break point is itself not executing.
Can any one of you tell me the reason for this.
In my web.config file, i set debug =true;
I made ensure regarding startup page and startup project.
Please reply as soon as possible
Thanks and regards,
Shyam T S
|
|
|
|
|
Is your project running in Debug or Release mode (the drop down on your toolbar will tell you this)? Even if you say Debug=True, if you are running in Release mode it wont stop on breakpoints.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy) "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
Thank you very much..
I have posted another query.. can u please look into it.. I am beginner.. Please help me..
|
|
|
|
|
Hi Guy's,
Please can you explain, how I can to configure localhost smtp server to send mail from my web application? I tried, but i get this error. Please help!
<br />
System.Net.Mail.SmtpException was caught<br />
Message="Failure sending mail."<br />
Source="System"<br />
StackTrace:<br />
at System.Net.Mail.SmtpClient.Send(MailMessage message)<br />
at _Default.Button1_Click(Object sender, EventArgs e) in c:\Inetpub\wwwroot\motoman\Default.aspx.cs:line 28<br />
<br />
Thanks in Advance
|
|
|
|
|
|
First you have to make sure the SMTP service installed on your PC?
And you might post your code here...
<< >>
|
|
|
|
|
SMTP Service is running.
<br />
ailMessage msg = new MailMessage("sample@lookman","kapat_saltcode@yahoo.com");<br />
msg.Body = "Did u receive this, if u did don't reply, just testing";<br />
msg.Subject = "TESTING";<br />
try<br />
{<br />
SmtpClient sc = new SmtpClient("lookman");<br />
sc.Send(msg);<br />
}<br />
catch (SmtpException smtpex)<br />
{<br />
Label1.Text = smtpex.Message.ToString();<br />
}<br />
catch (Exception ex)<br />
{<br />
Label1.Text = ex.Message.ToString();<br />
}<br />
|
|
|
|
|
MailMessage mail = new MailMessage();
mail.From = new MailAddress("me@mycompany.com");
mail.To.Add("you@yourcompany.com");
mail.Subject = "This is an email";
mail.Body = "this is a sample body with html in it. This is bold <font color=#336699>This is blue</font>";
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("127.0.0.1");
smtp.Send(mail);
That is from the link I provided. Does that shed any light on the subject?
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy) "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
|
how we can validate the TextBox with length not less than 3 digit and not more than 15 digite.
witch validation control is best.
|
|
|
|
|
<script Language="JavaScript">
function Length_TextField_Validator()
{
if ((form_name.text_name.value.length < 3) || (form_name.text_name.value.length > 15))
{
mesg = "You have entered " + form_name.text_name.value.length + " character(s)\n"
mesg = mesg + "Valid entries are between 3 and 15 characters.\n"
mesg = mesg + "Please verify your input and submit again."
alert(mesg);
form_name.text_name.focus();
return (false);
}
return (true);
}
</script>
--------------------------------------------------------------------------------------------------
Hiral Shah
India
If you think that my answer is good enough and can be helpful for other then don't forget to vote. 
|
|
|
|
|
Set the MaxLength for the textbox to 15 and then set a Regular Expression validator and find an expression along the lines of $(/d(3))^ or something.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy) "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
|
jayvaishnav82 wrote: length not less than 3 digit and not more than 15 digit
So, range from 100 to 999999999999999? RangeValidator maybe...
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Help!
I have two Textboxes that I extended with the AJAX Calendar Extender. Now I need to use those textboxes as parameters to a SQL Query.
My Code looks like this at the moment:
da_Top25Devices.SelectCommand.Parameters.Add(new SqlParameter("@DateFrom", SqlDbType.DateTime, 8));
da_Top25Devices.SelectCommand.Parameters["@DateFrom"].Value = Convert.ToDateTime(txtDateFrom);
da_Top25Devices.SelectCommand.Parameters.Add(new SqlParameter("@DateTo", SqlDbType.DateTime, 8));
da_Top25Devices.SelectCommand.Parameters["@DateTo"].Value = Convert.ToDateTime(txtDateTo);
I get the following error when I run in debug mode:
System.InvalidCastException: Unable to cast object of type 'System.Web.UI.WebControls.TextBox' to type 'System.IConvertible'.
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
It's because you can't convert a Textbox into a DateTime object - try using txtDateFrom.Text
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
If I change it to txtDateFrom.Text; I get this error.
Failed to convert parameter value from a ListItem to a String.
Illegal Operation
Making Computer Software Talk
|
|
|
|
|
Do your extended textboxes have a valid .Text property or is there some other way you need to access the value in the box?
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy) "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
i need to change the page layout of the web page in asp.net 2005 how to do?
|
|
|
|
|
Change how?
You could use positioned divs, css or a variety of methods depending on what you're trying to acieve
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Dear friends
I have one web based application. I have four buttons like Add,Delete, Edit etc. I need short cut keys to be attached for the execution of all buttons. like for Add I can use Alt+A
Also I have one combo box control whose items are very big string but since my width of combo box is very small I am not able to read the complete items value. How can I use the tool tip to show the user complete item string of a selected item from combo box.
Your quick response will be highly appreciated.
Regards and Thanks
Murtuza Patel
|
|
|
|
|
|
How to use shortcut keys in web development like we r using in desktop applications for differeent types of action such as Help -F1.
trrtuu
|
|
|
|
|
You can assign access keys to hyperlinks. For example:
<a href="myhelpfile.htm" accesskey="H">Help</a>
|
|
|
|