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)


ViralNews said…
You've made a terrific blog. If you have a web site, I'm sure you'd like FREE Content Get your FREE Content

Popular posts from this blog

Working with double quotes (") in VB.Net

Using VB Script to display part of an IP address

Object reference not set to an instance of an object when using HTMLEditorExtender