Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 8th, 2006, 08:19 AM
Authorized User
 
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default can someone help mi ? i m quite a newbie ..[xx(]

Imports System.Net

Imports System.IO

Imports System.Text

Public Class WebForm1

Inherits System.Web.UI.Page




#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Protected WithEvents Image1 As System.Web.UI.WebControls.Image

'NOTE: The following placeholder declaration is required by the Web Form Designer.

'Do not delete or move it.

Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

'CODEGEN: This method call is required by the Web Form Designer

'Do not modify it using the code editor.

InitializeComponent()

End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim objWebRequest As WebRequest = WebRequest.Create(objURI)

Dim objWebResponse As WebResponse = objWebRequest.GetResponse()

Dim objStream As Stream = objWebResponse.GetResponseStream()

Dim objStreamReader As StreamReader = New StreamReader(objStream)

Dim strHTML As String = objStreamReader.ReadToEnd



If strHTML.StartsWith("<div> <img src=") Then



Dim lastLocation As String

strHTML = strHTML.Substring(strHTML.IndexOf("http://www.onemotoring.com.sg/trafficsmart/images/",35))

Image1.ImageURL = strHTML



objStreamReader.Close()



Else

Response.Write("Unsuccessful")



End If



End Sub

End Class

---------------------------------------------------------END-----------------------------------------------------------------------------------

i want to grab the image's url from the source : http://202.172.177.75/trafficsmart/images/6708.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
  <HEAD>
  <meta http-equiv="progma" content="no-cache"/>
  <meta http-equiv="expires" content="-1" />
  <meta http-equiv="cache-control" content="no-cache">
  <TITLE>One Motoring - Camera Image - 6708</TITLE>


  <script language="javascript">
  var _hbEC=0,_hbE=new Array;function _hbEvent(a,b){b=_hbE[_hbEC++]=new Object();b._N=a;b._C=0;return b;} var hbx=_hbEvent("pv");hbx.vpc="HBX0100u";hbx.gn="ehg-greendot.hitbox.com";
  //BEGIN EDITABLE SECTION
  //CONFIGURATION VARIABLES
  hbx.acct="DM5506245DAS";//ACCOUNT NUMBER(S) - DM5506245DAS
  hbx.pn="";//PAGE NAME(S)
  hbx.mlc="/Home/Traffic/Camera";//MULTI-LEVEL CONTENT CATEGORY
  hbx.pndef="title";//DEFAULT PAGE NAME
  hbx.ctdef="full";//DEFAULT CONTENT CATEGORY

  //OPTIONAL PAGE VARIABLES
  //ACTION SETTINGS
  hbx.fv="";//FORM VALIDATION MINIMUM ELEMENTS OR SUBMIT FUNCTION NAME
  hbx.lt="auto";//LINK TRACKING
  hbx.dlf="n";//DOWNLOAD FILTER
  hbx.dft="n";//DOWNLOAD FILE NAMING
  hbx.elf="n";//EXIT LINK FILTER

  //SEGMENTS AND FUNNELS
  hbx.seg="1";//VISITOR SEGMENTATION
  hbx.fnl="";//FUNNELS

  //CAMPAIGNS
  hbx.cmp="";//CAMPAIGN ID
  hbx.cmpn="";//CAMPAIGN ID IN QUERY
  hbx.dcmp="";//DYNAMIC CAMPAIGN ID
  hbx.dcmpn="";//DYNAMIC CAMPAIGN ID IN QUERY
  hbx.dcmpe="";//DYNAMIC CAMPAIGN EXPIRATION
  hbx.dcmpre="";//DYNAMIC CAMPAIGN RESPONSE EXPIRATION
  hbx.hra="";//RESPONSE ATTRIBUTE
  hbx.hqsr="";//RESPONSE ATTRIBUTE IN REFERRAL QUERY
  hbx.hqsp="";//RESPONSE ATTRIBUTE IN QUERY
  hbx.hlt="";//LEAD TRACKING
  hbx.hla="";//LEAD ATTRIBUTE
  hbx.gp="";//CAMPAIGN GOAL
  hbx.gpn="";//CAMPAIGN GOAL IN QUERY
  hbx.hcn="";//CONVERSION ATTRIBUTE
  hbx.hcv="";//CONVERSION VALUE
  hbx.cp="null";//LEGACY CAMPAIGN
  hbx.cpd="";//CAMPAIGN DOMAIN

  //CUSTOM VARIABLES
  hbx.ci="";//CUSTOMER ID
  hbx.hc1="";//CUSTOM 1
  hbx.hc2="";//CUSTOM 2
  hbx.hc3="";//CUSTOM 3
  hbx.hc4="";//CUSTOM 4
  hbx.hrf="";//CUSTOM REFERRER
  hbx.pec="";//ERROR CODES

  //INSERT CUSTOM EVENTS
  //var ev1 = new _hbEvent("search");

  //END EDITABLE SECTION
  //REQUIRED SECTION. CHANGE "YOURSERVER" TO VALID LOCATION ON YOUR WEB SERVER (HTTPS IF FROM SECURE SERVER)
  </script>
  <script language="javascript1.1" defer src="http://www.onemotoring.com.sg/publish/scripts/hbx.js"></script>


  <link rel="stylesheet" href="http://www.onemotoring.com.sg/publish/styles/om_masthead.css" type="text/css"/>
  <link rel="stylesheet" href="http://www.onemotoring.com.sg/publish/styles/om_style.css" type="text/css"/>
</HEAD>

<BODY>
  <div id="popup_content">
     <div id="subpage_content">
       <div align="center">
         <h3> View from Jurong West ST81 (Towards Jurong) </h3>
         <p>Time: 08/06/2006 20:58 hrs</p>
         <div> <img src="http://www.onemotoring.com.sg/trafficsmart/images/6708_2058_20060608205713_aa6397.jpg" border="0"></div>
       <h5>Image from Intelligent Transport Systems Center, LTA</h5>
      </div>
    </div>
  </div>
</BODY>
</HTML>


-------------------------------------------------------------------------------end---------------------------------------------------------------------------------------------------------

i need to read the line to the end.. and when it start with '<img src=' i will grab the image's URL (strHTML =http://www.onemotoring.com.sg/trafficsmart/images/6708_2058_20060608205713_aa6397.jpg), because the address keep on changing so i need to grab that line in order to view the image ..

but how? the above is my code but it since like cannot work...



Hope you can help me.

Cathleen




 
Old June 8th, 2006, 02:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

I don't understand what you want to do...

Brian
 
Old June 8th, 2006, 08:51 PM
Authorized User
 
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually my project need me to extract a url(eg. src="http://www.onemotoring.com.sg/trafficsmart/images/XXX), but the url keep on changing. Is there any way i can get the updated url using sub string? The only part the url that will change is as shown in (XXX) in the example.


 
Old June 9th, 2006, 09:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

You mean something like this:

http://www.dotnetjohn.com/articles.aspx?articleid=93

Brian
 
Old June 9th, 2006, 12:59 PM
Authorized User
 
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

omg .. u are my saviour THNK U!!!!!!!!!!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed - data from Excel sht where Date>= xx pandasum Visual Basic 2005 Basics 0 August 19th, 2007 11:34 PM
can someone help mi ? g0dchild_85 C# 5 August 9th, 2006 09:31 AM
can someone help mi >? g0dchild_85 C# 5 July 4th, 2006 03:13 AM
Dynamic Controls [xx(] koneruvijay VS.NET 2002/2003 0 November 12th, 2003 12:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.