Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 736257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:35:02+00:00 2026-05-14T07:35:02+00:00

What is the best method to obfuscate the urls created in Dynamic Data? eg

  • 0

What is the best method to obfuscate the urls created in Dynamic Data?

eg \Products\List.aspx?ProductId=2 could become

\Products\List.aspx?x=UHJvZHVjdElkPTI=

where “ProductId=2” is base 64 encoded to prevent casual snooping on

\Products\List.aspx?ProductId=3

\Products\List.aspx?ProductId=4

etc…?

I will probably have to inherit from an existing object and override some function
The question is which object and what function

GetActionPath of the Metamodel object seems interesting,
but how does the DynamicRoute “{table}/{Action}.aspx” play in into it…

Right now on Asp.net 1.1 site I use an custom implementation of the following code.
http://www.mvps.org/emorcillo/en/code/aspnet/qse.shtml It is HTTPModule that uses regular expression to rewrite all the querystrings and also with reflection changes the Querystring collection with decoded values.

So where is the hook to affect the change.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:35:02+00:00Added an answer on May 14, 2026 at 7:35 am

    I have found the solution

    With advice, I have implemented a Route that inherits from DynamicDataRoute.

    The methods overridden were GetVirtualPath and GetRouteData.

    Here is the global.asax page

     routes.Add(New EncodedDynamicDataRoute("{table}/{action}.aspx") With { _
    .Defaults = New RouteValueDictionary(New With {.Action = PageAction.List}), _
    .Constraints = New RouteValueDictionary(New With {.Action  "List|Details|Edit|Insert"}), _
    .Model = model})
    

    Here is the Encoded DynamicDataRoute.

    Imports System.Web.DynamicData
    Imports System.Web.Routing
    ''' <summary>
    ''' The purpose of this class to base 64 encode the querystring parameters.
    ''' It converts the keys to base64 encoded and back.
    ''' </summary>
    Public Class EncodedDynamicDataRoute
    Inherits DynamicDataRoute
    Public Sub New(ByVal url As String)
        MyBase.New(url)
    End Sub
    
    Public Overloads Overrides Function GetRouteData(ByVal httpContext As HttpContextBase) As RouteData
        Dim routeData As RouteData = MyBase.GetRouteData(httpContext)
        If Not (routeData Is Nothing) Then
            DecodeRouteValues(routeData.Values)
        End If
        Return routeData
    End Function
    Private Sub EncodeRouteValues(ByVal routeValues As RouteValueDictionary)
        Dim tableName As Object
        If Not routeValues.TryGetValue("table", tableName) Then
            Return
        End If
        Dim table As MetaTable
        If Not Model.TryGetTable(DirectCast(tableName, String), table) Then
            Return
        End If
        Dim strOutput As New StringBuilder
        Dim val As Object
        For Each column As MetaColumn In table.PrimaryKeyColumns
            If routeValues.TryGetValue(column.Name, val) Then
                strOutput.Append(column.Name & Chr(254) & val & Chr(255))
                routeValues.Remove(column.Name)
            End If
        Next
        Dim out As String = (Convert.ToBase64String(Encoding.ASCII.GetBytes(strOutput.ToString)))
        If routeValues.ContainsKey("x") Then
            routeValues.Item("x") = out
        Else
            routeValues.Add("x", out)
        End If
    End Sub
    Public Overloads Overrides Function GetVirtualPath(ByVal requestContext As RequestContext, ByVal values As RouteValueDictionary) As VirtualPathData
        EncodeRouteValues(values)
        Return MyBase.GetVirtualPath(requestContext, values)
    End Function
    Private Sub DecodeRouteValues(ByVal routeValues As RouteValueDictionary)
        Dim tableName As Object
        If Not routeValues.TryGetValue("table", tableName) Then
            Return
        End If
        Dim table As MetaTable
        If Not Model.TryGetTable(DirectCast(tableName, String), table) Then
            Return
        End If
        Dim enc As New System.Text.ASCIIEncoding()
        Dim val As Object
        If routeValues.TryGetValue("x", val) AndAlso val <> "AAA" Then
            Dim strString As String = enc.GetString(Convert.FromBase64String((val)))
            Dim nameValuePairs As String() = strString.Split(Chr(255))
            Dim col As MetaColumn
            For Each str11 In nameValuePairs
                Dim vals() As String = str11.Split(Chr(254))
                If table.TryGetColumn(vals(0), col) Then
                    routeValues.Add(val(0), col)
                End If
            Next
        End If
       End Sub
      End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Duplicate: Best way to obfuscate an e-mail address on a website? Effective method to
Best method to add/remove webcontrols or user controls in asp.net for dynamic forms without
What is the best method for comparing IEEE floats and doubles for equality? I
What is the best method to parse multiple, discrete, custom XML documents with Java?
What is the best method for including a CSS or Javascript file for a
What is the best method to get objects out of a BlockingQueue, in a
What is the best method for executing FTP commands from a SQL Server stored
what is the best method for inter process communication in a multithreaded java app.
What is the best method for removing a table row with jQuery?
What is the best method for adding options to a <select> from a JavaScript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.