How to know a site's default index page form?

Discussion in 'C#' started by JJnacy, Jul 5, 2009.

  1. #1
    Usually see people use URL http : // a domain name . com

    Question is :

    How to find out that site's default page form?
    example :
    http : // a domain name . com / index .php
    or
    http : // a domain name . com / default .asp
    or
    http : // a domain name . com / index .html
    or
    http : // a domain name . com / welcome .htm
    or
    other name


    Thanks,
     
    JJnacy, Jul 5, 2009 IP
  2. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Unless they link to it directly (e.g the 'Home' link), just guess until you find it. Look at other pages on the site and see what format they are (e.g: .php, .asp, .html) For example if all the pages on the site are .php, try index.php and default.php .... You could write a script to do this if necessary, but I don't think there is any other way to do this directly.
     
    camjohnson95, Jul 5, 2009 IP
  3. JJnacy

    JJnacy Peon

    Messages:
    448
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, I need the script.

    Could some one show the script?
    Is it by checking the site's headers?

    Thanks,
     
    JJnacy, Jul 5, 2009 IP
  4. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    keep in mind that the default files for a directory can be changed to anything... but generally it won't be.
     
    camjohnson95, Jul 5, 2009 IP
  5. JJnacy

    JJnacy Peon

    Messages:
    448
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Another way to ask the question.

    How to know an URL's whole URL?
     
    JJnacy, Jul 5, 2009 IP
  6. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #6
    If you want to know the default url of a site which u dont own then u just have to try all the extensions manually i guess
     
    Bohra, Jul 5, 2009 IP
  7. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #7
    Here is a simple script in .NET:
    
       Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim strFiles As String
            Dim files() As String
            Dim domain As String
            strFiles = "index.html,index.htm,default.htm,default.html,index.asp,default.asp,index.aspx,default.aspx,index.php,index.cgi,index.pl"
            domain = "http://www.google.com/"
            files = strFiles.Split(",")
            For Each i In files
                If CheckURL(domain & i) Then MsgBox(domain & i) : Exit Sub
            Next
            MsgBox("Not Found")
        End Sub
        Function CheckURL(ByVal strURI As String) As Boolean
            Dim res As WebResponse
            Try
                res = WebRequest.Create(New Uri(strURI)).GetResponse()
                res.Close()
                CheckURL = True
            Catch ex As Exception
                CheckURL = False
            End Try
        End Function
    
    Code (markup):
    Must Import System.Net

    You can add more file names if necessary...
     
    camjohnson95, Jul 5, 2009 IP
  8. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #8
    You could achieve the same result with Classic ASP but would have to use XMLHttp and different error trapping technique.
     
    camjohnson95, Jul 5, 2009 IP
  9. selinangela

    selinangela Peon

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    it's hard to know...
     
    selinangela, Jul 10, 2009 IP