1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

request.mappath

Discussion in 'Scripting & Programming' started by mridu_kr, Jan 6, 2008.

  1. mridu_kr

    mridu_kr Bit Poster

    17
    0
    2
    what is the difference between server.mappath and request.mappath?
     
  2. zebulebu

    zebulebu Terabyte Poster

    3,748
    330
    187
    Dude

    Second link in a basic Google search:

    http://www.tech-archive.net/Archive...dotnet.framework.aspnet/2007-10/msg00767.html
     
    Certifications: A few
    WIP: None - f*** 'em
  3. mridu_kr

    mridu_kr Bit Poster

    17
    0
    2
    thanks a lot.
     
  4. mridu_kr

    mridu_kr Bit Poster

    17
    0
    2
    if they are same, then y dont they have a single name?

    y use two names when the result is same?
     
  5. Fergal1982

    Fergal1982 Petabyte Poster

    4,196
    171
    211
    Does it really matter? There are various reasons why it could be. For a start, one of them could be deprecated in favour of the other (much like msgbox versus messagebox in vb.net), or it could be that at one time they referred to something slightly different, but have now converged to have the same definition.

    The important thing is that the result is the same, so which you use is down to personal preference.

    Edit: In fact, its exactly like the difference between:
    System.IO.File.Exists("C:\test.txt")

    and

    My.Computer.FileSystem.FileExists("C:\test.txt")

    There isnt any difference, its just a different way of getting the same information. Its just a shortcut to get the same information. Rather than include two separate chunks of code in the framework, they have simply set one or the methods to point to the other, meaning that if they need to modify the method, they just do it in one place.

    In personal programming, consider this:

    Code:
    Private Sub mysub()
            MessageBox.Show("The current time is " & Now.ToString)
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            mysub()
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            mysub()
        End Sub
    
    You have created a single sub that returns the current time, but you have two buttons that need to perform the same action. I could have put the code into each of the click events individually, but instead I chose to write a third sub, and have the click events call that third sub. If I ever need to expand the functionality of the sub, I Only have to change it in one place.

    the .mappath is essentially the same thing.
     
    Certifications: ITIL Foundation; MCTS: Visual Studio Team Foundation Server 2010, Administration
    WIP: None at present
  6. mridu_kr

    mridu_kr Bit Poster

    17
    0
    2
    thank you for yr time n yr reply.
     

Share This Page

Loading...