Results 1 to 4 of 4

Thread: [RESOLVED] Modify a Stored URL

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    15

    Resolved [RESOLVED] Modify a Stored URL

    Is this possible? I have a dynamic URL I'm navigating to. I go to 'http://www.URL.com' and the address bar will read 'http://www.URL.com/asDSFjhfdsja4545/login.aspx' from that point on the underlined stays static but everything after the / is dynamic. Can I modify the string to keep everything that is underlined, remove the login.aspx and add to the URL main.aspx to a different variable, still keeping the original variable in case I need to refer to it.

    Code:
    Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
        If (pDisp Is WebBrowser1.Application) Then
            StoredURL = URL
            Exit Sub
        End If
    End Sub
    That is what I currently have, it just captures the URL and stores it in the Public variable StoredURL, which I want to modify.

  2. #2

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    15

    Re: Modify a Stored URL

    Okay that works at first, but on later pages I want to remove two "/" worth of code. Say we have http://www.URL.com/NewPage/Index.html and I want to remove /NewPage/Index.html, is there any way to do that with out using the same code twice, which is how I currently have it working?
    Code:
    StoredURL = Left$(StoredURL, InStrRev(StoredURL, "/") - 1)
    StoredURL = Left$(StoredURL, InStrRev(StoredURL, "/") - 1)

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Modify a Stored URL

    Code:
    Dim intPos As Integer
    Dim strParts() As String
    
    strParts = Split(StoredURL, "//")
    StoredURL = strParts(1)
    intPos = InStr(1, StoredURL, "/")
    StoredURL = Left$(StoredURL, intPos - 1)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width