Click here to Skip to main content
15,895,740 members

Comments by PDTUM (Top 10 by date)

PDTUM 13-Dec-19 15:23pm View    
Hello Richard. Thank you for your response. Please see the following:

The Webpage textbox looks like this:



Beginning, let me thank you. I do not think that I explained it properly, which happens when you are trying not to reveal private information. First, the page that is 'sending' the data is not mypage.ascx ... it is mypage.cs (Winforms, not a web page). Second, the website is not mine. It is a resource. But because it is public, let me lift the veil off it. I am trying to use a site called (www.decodethis.com). It is totally legitimate to use it, but many of my customers that use the site by reference make mistakes when transferring the 17 digit VIN number to the site manually. My idea was to have them enter the information inside the application that I wrote and have it passed to the 'decodthis' page to have it processed and get a result. I am not sure that it is even possible to do this, but since it should not matter whether the number to be decoded was entered manually or automatically, it seemed to make sense to do it this way. If it would help. I could make a webpage on my end and then use aspx.cs code to accomplish the same thing if that would work. But I prefer to use the actual application if possible. With that said, all the information about the web text box is visible using the element examination feature. SO ... perhaps using the real-life naming on the actual page ... could you please suggest a way to accomplish this task (if it can be done at all?). All I want to do is pass the information from the desktop application (main.cs) to the webpage (www.decodethis.com) automatically. Thank you again!
PDTUM 12-Dec-19 18:05pm View    
Bobby, thank you for your reply. I do not know why the complete information that I posted did not appear, so I apologize. I gave a precise example of what I was trying to do. I have been using Code Project for over 15 years and it gets less friendly every year. I looked into Selenium and I do not understand how to install it or what it even does. The download does not have an executable. But it was important to me to make time to thank you for your advice and effort. Best Regards, Pat.
PDTUM 28-Mar-17 13:46pm View    
And so ... I am sorry to say it did not make a difference. Just in case, I am posting what I tried below. I also tried hard coding the string into the src call on the aspx page. I think it was a GREAT idea, and I thought this was it. Back to square one. If you have any other thoughts or see a problem with my code, let me know. Many thanks, Pat.

string pdfPage = "https://docs.google.com/gview?url=" + doc + "&embedded=true";
pdf.Attributes.Add("src", pdfPage);
PDTUM 28-Mar-17 13:26pm View    
Wow Richard. Great thought. The answer is YES, it is a secure site. I told my network architect that I thought it was a config issue, and now I might be vindicated. I don't know if this is the fix, but it is sure promising. I REALLY APPRECIATE the idea and I am going to try it out shortly. I spent the entire day yesterday undoing all the old code and changing to JavaScript (which I hate but it does work). I would happily invest another day to put it all back. Just one more question if I may? Why is there an issue with the iFrame? Also, I got it to work correctly in IE Edge on Windows 10 using an Embed code (posted below), but it would not work in Chrome or Firefox (which is my developer default). I'll post results here. Keep in touch. Code follows. Best Regards, Pat.

(This works in Edge!)
pdfViewer.InnerHtml = "<embed src='" + item + "' type='application/pdf' scrolling='auto' height='530px' width='560px'>";
PDTUM 27-Mar-17 12:15pm View    
Hello Tandit, THANK YOU for your reply!

So, the reason that I used Google Docs at all is that I could not get it to work in an HTML5 iFrame and some others I have spoken to have used this technique successfully with Google Docs. Below is the original code:

if (Session["Document"].ToString() != string.Empty)
{
string document = Session["Document"].ToString();
pdfIframe.Attributes.Add("src", document);
}

Although you may be right about Google Docs (I do not know), that does not explain why it will not work with a regular iFrame, as it is supposed to in HTML5. This is not a contest or a challenge. I greatly appreciate your reply and suggestion. With that said, I find it incredible to believe that there is no real C# solution to address viewing a PDF in an HTML format! Yes, I could easily get the job done by using a text area with a database query (Fast and Easy!), but it looks so unprofessional. I even considered taking a picture of the document and posting it as a JPG, however, then multiple pages and scrolling create a new problem. This is very discouraging. I personally really dislike using JAVA and I avoid it except where absolutely necessary. This is why I choose to write desktop applications and I avoid the internet unless it is absolutely necessary. If you could explain why the iFrame will not work or if you know of any other solution, please let me know. I will be at my desk working for at least the next 6 hours. THANK YOU AGAIN for your input and advice. It is appreciated! Pat.