Invalid path for child request

Q: I call another web page from the application and pass it an argument (see sample below), but I receive the error "Invalid path for child request".

Dim strPath As String = "Error.aspx?Msg=" & strMsg
Server.Transfer(strPath, True)


A: Since the argument passed is not URL encoded, it causes the path of the web page being called to be incorrect. To correct the problem simply URL encode the argument being passed to the new page.

Dim strPath As String = "Error.aspx?Msg=" & Server.UrlEncode(strMsg)
Server.Transfer(strPath, True)

Comments

Popular posts from this blog

Using VB Script to display part of an IP address

Working with double quotes (") in VB.Net

Oct'18 Meeting Wrap-up