Tuesday, September 20, 2005

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)

1 comment:

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