Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

Dimitri Backaert

@Dimitri Backaert
About
Posts
10
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • [C#.NET 2008] Screen-scraping a HTML Page
    D Dimitri Backaert

    James, Thank you for your answer. This could do the trick. I'll try it out. I already was thinking about changing the HttpWebRequest in another method, because in my opinion a WebRequest is the equivalent of a GET. What I need is a POST, so I'm thinking of using an HttpWebResponse...

    C# csharp help html security question

  • [C#.NET 2008] Screen-scraping a HTML Page
    D Dimitri Backaert

    This might all seem very funny, I know, but it doesn't solve my problem.... :doh: Concerning the chairman, A request has been sent by my manager. But this might take a while to achieve (office / political war between Belgium / Netherlands). The main reason why the Netherlands are unwilling to release information, is that they were formerly the only group that maintained all the ICT infrastructure for the whole Benelux company group. However, since the beginning of 2009, Belgium and Luxemburg splitted from the Netherlands, and created their own ICT division. I think it's some sort of Job Protection... Politics, money, it's all involved. And it's - excuse my language - a real pain in the ass...

    C# csharp help html security question

  • [C#.NET 2008] Screen-scraping a HTML Page
    D Dimitri Backaert

    Yes I do, it's to prevent unauthorised access to the page... :laugh: However, this is a Web page that exists on the intranet of our company network. It displays certain measures which we want to display on a Dashboard application. The idea is to have an overview of these values at the blink of an eye (the dashboard will be projected on a whiteboard). Normally, we would use a read account on the database for this, but (since the database is being managed by the Netherlands and I am a Belgian employee) the Netherlands are refusing to give us a read account. So this is the only way how we can succeed in building the dashboard.

    C# csharp help html security question

  • [C#.NET 2008] Screen-scraping a HTML Page
    D Dimitri Backaert

    Hi, I'm trying to process the HTML source code from a certain web page. This web page has security enabled, using a Username & a password. I'm using the following method to try to access the page:

    public static string GetHtmlPageSource(string url, string username, string password)
    {

    WebClient wc = new WebClient();
    
    wc.Credentials = new NetworkCredential(username, password);
    
    try
    {
    	using (Stream stream = wc.OpenRead(new Uri(url)))
    	{
    		using (StreamReader reader = new StreamReader(stream))
    		{
    			return reader.ReadToEnd();
    		}
    	}
    }
    catch (WebException e)
    {
    	//Error handeling 
    	return e.ToString();
    } 
    

    }

    This doesn't work however, I seem to be stuck at the logon page. I'm not able to pass the user security. Anyone has an idea?

    C# csharp help html security question

  • Getting HTML Source from a WebPage in String-format, using NetworkCredentials [modified]
    D Dimitri Backaert

    Nobody? :-S This is what I found out: - The "page" variable gets a value, but when viewing this value using the built-in HTML viewer, I get the login-page. - At the bottom of this page, a message is displayed saying "Your browser is not supported". Could this cause the problem? If so, is there an alternative to make this work? Thanks in advance.

    C# database csharp html security question

  • Getting HTML Source from a WebPage in String-format, using NetworkCredentials [modified]
    D Dimitri Backaert

    Hi, In order to create a dashboard application, I need to read an HTML site's source code. This contains the values (integers) which I want to process. I don't have access to the SQL-database, so this is the only way I can achieve my goal, and deliver the application. The site uses a Username & Password as security, and I am able to access the login page. However, when passing the credentials, I'm not able to read the source code (it seems like the credentials aren't valid). However, when using the same credentials directly in Internet Explorer, I'm able to access the webpage. This is the code I have so far. Any of you experts see what I'm doing wrong? PS: I've changed the site-url, username & password, since it's a confidential site of my company.

        public static string GetHtmlPageSource(string url, string username, string password)
        {
            System.IO.Stream st = null;
            System.IO.StreamReader sr = null;
            try
            {
                // make a Web request
                System.Net.WebRequest req = System.Net.WebRequest.Create(url);
                // if the username/password are specified, use these credentials
                if (username != null && password != null)
                    req.Credentials = new System.Net.NetworkCredential(username, password);
                // get the response and read from the result stream
                System.Net.WebResponse resp = req.GetResponse();
                st = resp.GetResponseStream();
                sr = new System.IO.StreamReader(st);
                // read all the text in it
                return sr.ReadToEnd();
            }
            catch (Exception ex)
            {
                return string.Empty;
            }
            finally
            {
                // always close readers and streams
                sr.Close();
                st.Close();
            }
        }
    
        private void DataRefresh\_Tick(object sender, EventArgs e)
        {
            // Set the Refresh Interval to 15000 ms
            this.DataRefresh.Interval = 15000;
    
            // Declare the Variables, needed for this Application
            string FL, SL, UnFL, UnSL, ValueFL, ValueSL, ValueUnFL, ValueUnSL;
    
            //// Refresh the TopDesk Web Browser Object
            this.TopDesk.Refresh();
    
            //Read WebPage
            string page;
    
            page = GetHtmlPageSource("https://site", "user", "pass");
    
    
    
            //
    
    C# database csharp html security question

  • VB.NET 2008: Hide and/or disable Start Menu onLoad
    D Dimitri Backaert

    Isn't there another way around? Like, an auto closing MessageBox, displaying for example the text "Please wait. Your information is being printed", and when closing the MessageBox, returning to the startup page (which is also defined as TopMost)?

    Visual Basic csharp sales question

  • VB.NET 2008: Hide and/or disable Start Menu onLoad
    D Dimitri Backaert

    Hi, I have a Windows Form application that runs TopMost. In this application, there is a print function, which silently prints out a PDF file to the default printer. At the load of the Form, since the TopMost property is set to True, the Start Menu is hidden, which is exactly what I want. However, when the printing action is launched, the Start Menu pops up. This is triggered by the Taskbar (a little print icon is shown upon printing). Is there a way to prevent this? This application needs to run at an exposition, and will be launched on a touchscreen computer. The idea behind this, is that a customer can print a brochure of a product he's interested in. Secondly, I want to disable all the default shortcut keys to close the application (like ALT + F4, CTRL + ALT + DEL, etc.). Any ideas anyone? Kindly yours

    Visual Basic csharp sales question

  • VB.NET: Error adding multiple rows in a DataGridView (not bound to a DataTable)
    D Dimitri Backaert

    Hi Liqz, Thanks! That did the trick. I'll keep in mind that next time, I'll include the error message. Cheers.

    Visual Basic help csharp graphics algorithms

  • VB.NET: Error adding multiple rows in a DataGridView (not bound to a DataTable)
    D Dimitri Backaert

    Hi, I'm having problems adding multiple rows to a DataGridView, on the Load-event of a Windows Application Form. Adding one record doesn't cause a problem, but when adding the second record (using the identical code), an Exception is thrown. Here's my code so far (VB.NET 2008):

    Private Sub BWMFPForm\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim dgvRow As New DataGridViewRow
        Dim dgvCell As DataGridViewCell
        Dim dgvButton As DataGridViewImageColumn
        Dim column As DataGridViewColumn
    
        'Disable sorting for all Columns
        For Each column In DataGridViewBrochures.Columns
            column.SortMode = DataGridViewColumnSortMode.NotSortable
        Next
    
        'Add Record
        'Column 1: Machine
        dgvCell = New DataGridViewTextBoxCell()
        dgvCell.Value = "Aficio MP 4000 / Aficio MP 5000"
        dgvRow.Cells.Add(dgvCell)
        'Column 2: Speed
        dgvCell = New DataGridViewTextBoxCell()
        dgvCell.Value = "40 PPM / 50 PPM"
        dgvRow.Cells.Add(dgvCell)
        'Column 3: Language
        dgvCell = New DataGridViewTextBoxCell()
        dgvCell.Value = "Nederlands"
        dgvRow.Cells.Add(dgvCell)
        'Column 4: Image Print
        dgvButton = New DataGridViewImageColumn
        dgvButton.Image = Drawing.Image.FromFile("D:\\DEVPROJECTS\\MarketingTouchScreen\\TouchScreen\\images\\Print\_Icon.jpg")
        dgvButton.ReadOnly = True
        dgvButton.ImageLayout = DataGridViewImageCellLayout.Normal
        DataGridViewBrochures.Columns.Add(dgvButton)
        'Add the Row
        DataGridViewBrochures.Rows.Add(dgvRow)
    
        'Add Record
        'Column 1: Machine
        dgvCell = New DataGridViewTextBoxCell()
        dgvCell.Value = "Aficio MP 4000 / Aficio MP 5000"
        dgvRow.Cells.Add(dgvCell)
        'Column 2: Speed
        dgvCell = New DataGridViewTextBoxCell()
        dgvCell.Value = "40 PPM / 50 PPM"
        dgvRow.Cells.Add(dgvCell)
        'Column 3: Language
        dgvCell = New DataGridViewTextBoxCell()
        dgvCell.Value = "Nederlands"
        dgvRow.Cells.Add(dgvCell)
        'Column 4: Image Print
        dgvButton = New DataGridViewImageColumn
        dgvButton.Image = Drawing.Image.FromFile("D:\\DEVPROJECTS\\MarketingTouchScreen\\TouchScreen\\images\\Print\_Icon.jpg")
        dgvButton.ReadOnly = True
        dgvButton.ImageLayout = DataGridViewImageCellLayout.Normal
        DataGridViewBrochures.Columns.Add(dgvButton)
    
    Visual Basic help csharp graphics algorithms
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups