Had got chance to share the concept on urlMmappings from ASP.NET 2.0

While watching (enjoyed) the success of our Sprit, I wrote a simple article on urlMmappings feature in ASP.NET 2.0. Take a look at that article at http://www.w3coder.com/alphatalks/v2urlmap.aspx

 

Hopefully it will be helpful to some one out there who is interested to know the new features in ASP.Net world!

2 Comments

  • Good quesiton, when I first got Alpha, I tried it, but it did not woked, The reason I guess it, ASP.NET services takes it as a string and parse it to see for that!!



    I have tried to solve the same kind of business case by using Context.RewritePath technique.



    As our luck, in ASP.NET(global.asax) we have App_BeginReq, by taking advantage of that we can solve it. Below could could helps you on your business case!



    Sub Application_BeginRequest(ByVal Sender As Object, ByVal E As EventArgs)

    Response.Write("CAme in")

    'Response.End

    'Aim: Convert a path of the form from x.aspx to yy.aspx?id=x



    Dim context As HttpContext = HttpContext.Current



    Dim pastpath As String = context.Request.Path.ToLower()

    Dim DefPath As String = "/home/page"

    Dim i As Int32 = pastpath.IndexOf(DefPath)

    Dim DefPathlen As Int32 = DefPath.Length

    'Response.Write(pastpath)

    'Response.Write (i)

    'Response.End

    If (i <> -1) Then

    Dim j As Int32 = pastpath.IndexOf(".aspx")

    If (j <> -1) Then

    Dim id As String = pastpath.Substring(i + DefPathlen, j - (i + DefPathlen))

    Dim newpath As String = pastpath.Replace(DefPath + id + ".aspx",



    "/Default.aspx?tabid=" + id)

    context.RewritePath(newpath)

    End If

    End If



    End Sub





    Hope it helps you!!!

  • Thanks a lot, it works great in my app.

Comments have been disabled for this content.