Click here to Skip to main content
15,921,660 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionControl Word in OLE Pin
cop125-Sep-05 5:31
cop125-Sep-05 5:31 
QuestionSave Query "Image" problem Pin
bl@ck_rose25-Sep-05 2:44
bl@ck_rose25-Sep-05 2:44 
AnswerRe: Save Query "Image" problem Pin
cop125-Sep-05 3:35
cop125-Sep-05 3:35 
QuestionRe: Save Query "Image" problem Pin
bl@ck_rose25-Sep-05 3:46
bl@ck_rose25-Sep-05 3:46 
AnswerRe: Save Query "Image" problem Pin
cop125-Sep-05 5:13
cop125-Sep-05 5:13 
QuestionQuestion on set text in combo box Pin
cop125-Sep-05 2:38
cop125-Sep-05 2:38 
AnswerRe: Question on set text in combo box Pin
jo0ls25-Sep-05 6:57
jo0ls25-Sep-05 6:57 
QuestionExcel sheet Pin
ybasha25-Sep-05 0:10
ybasha25-Sep-05 0:10 
Hi there,
i have a program which check the url in database and using the http Response and request method it give me the out put whether the given url is valid r broken, my application work fine but when some url pass in this formate like "www.something.com/" my application is not working when url pass with the "/" pls help me how to solve this problem how to pass the url or how to truncate the slash "/"... pls give me some solution

This is the code snippet
------------------------------------------------------------------------
Public Function checkurl(ByVal url As String) As String
Dim req As System.Net.HttpWebRequest
Dim res As System.Net.HttpWebResponse
Dim r As System.IO.StreamReader
Dim ex As Exception 'error exeption holder
Dim pge As String 'page holder
Dim strreturnstring As String

Try
'display request url
req = req.Create(url)
req.AllowAutoRedirect = True


'set the user agent
'some site might brush you off if it is not set
'to stop bots and scrapers
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)"

'get page
res = req.GetResponse()
r = New System.IO.StreamReader(res.GetResponseStream())
pge = r.ReadToEnd
r.Close()
res.Close()

strError = "OK"
status = "True"


'Convention is First Value is the Status and Second value is Errmsg
strreturnstring = status & "~" & strError
Return strreturnstring

Catch ex
status = "False"
strError = ex.Message
strreturnstring = status & "~" & strError
Return strreturnstring

End Try

End Function
--------------------------------------------------------------------
this is the code snippet for select from database
objConn.Open()
da = New SqlClient.SqlDataAdapter("Select SRNO, IDENTIFIER, TITLE, PHY_PATH as IDENTIFIER_URL," & _
" BROKEN_LINK_INFORMATION='', STATUS='' from web_resource where PHY_PATH like ''http://sunsite.berkeley.edu/''", conn)
da.Fill(ds)


Dim strValues As String
If ds.Tables(0).Rows.Count > 0 Then
For I As Integer = 0 To ds.Tables(0).Rows.Count - 1
strValues = checkurl(ds.Tables(0).Rows(I).Item("PHY_PATH"))
Dim strArrvals As String()
strArrvals = strValues.Split("~")

If strArrvals.Length > 0 Then

strError = strArrvals(1).ToString()
status = strArrvals(0).ToString()

End If
ds.Tables(0).Rows(I).Item("ERROR") = strError
ds.Tables(0).Rows(I).Item("STATUS") = status

Next
fncExcelExport(ds)
End If
-------------------------------------------------------------

regards
cyus

-- modified at 6:10 Sunday 25th September, 2005
AnswerRe: Excel sheet Pin
cop125-Sep-05 4:34
cop125-Sep-05 4:34 
AnswerRe: Excel sheet Pin
cop12-Oct-05 18:45
cop12-Oct-05 18:45 
QuestionDetectig in an application is loaded Pin
subscr2224-Sep-05 23:01
subscr2224-Sep-05 23:01 
AnswerRe: Detectig in an application is loaded Pin
jo0ls25-Sep-05 7:03
jo0ls25-Sep-05 7:03 
AnswerRe: Detecting if an application is loaded Pin
subscr2225-Sep-05 13:36
subscr2225-Sep-05 13:36 
Questiondatagrid Pin
dap_qk24-Sep-05 22:17
dap_qk24-Sep-05 22:17 
AnswerRe: datagrid Pin
_mubashir25-Sep-05 23:58
_mubashir25-Sep-05 23:58 
QuestionRuntime Error Pin
24-Sep-05 21:56
suss24-Sep-05 21:56 
QuestionIPC Pin
kaln24-Sep-05 21:05
kaln24-Sep-05 21:05 
Questionsockets!! Pin
ecentinela24-Sep-05 11:02
ecentinela24-Sep-05 11:02 
QuestionVedio Stream from TV Tuner Pin
shoaibnawaz24-Sep-05 10:52
shoaibnawaz24-Sep-05 10:52 
QuestionUsing a combobox with a datagrid Pin
amber_BC24-Sep-05 9:31
amber_BC24-Sep-05 9:31 
AnswerRe: Using a combobox with a datagrid Pin
rwestgraham24-Sep-05 10:03
rwestgraham24-Sep-05 10:03 
QuestionRe: Using a combobox with a datagrid Pin
amber_BC24-Sep-05 10:19
amber_BC24-Sep-05 10:19 
AnswerRe: Using a combobox with a datagrid Pin
rwestgraham24-Sep-05 11:02
rwestgraham24-Sep-05 11:02 
Questioncrystal report Pin
daneshmand24-Sep-05 5:54
daneshmand24-Sep-05 5:54 
AnswerRe: crystal report Pin
shoaibnawaz24-Sep-05 10:16
shoaibnawaz24-Sep-05 10:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.