rclayh
Posts: 8
|
Posted: 04/08/2005, 7:29 AM |
|
Here's a simple fix for one of CC's missing features. I often want to call a maintenance page from someplace else and go back to it. You can set the RedirectURL but your keys get dropped. Here is a simple piece of code that you can drop in the OnClick event of your buttons and it'll will allow you to pass in a ReturnPage in the query string and come back to it with your keys in tact.
Dim RawURL as String = System.Web.HttpContext.Current.Request.RawUrl
Dim KeyReturnString as String = ""
Dim ReturnPage As String
Try
ReturnPage = System.Web.HttpContext.Current.Request.QueryString("ReturnPage")
'Add the query string part of the RawURL
Dim BreakPoint as Integer = Instr(1,RawURL,"?")
KeyReturnString = Mid(RawURL, Breakpoint + 1)
ReturnPage = ReturnPage & "?" & KeyReturnString
RedirectUrl = (ReturnPage).ToString()
Catch
'ReturnPage not found don't do a dang thing
End Try
This is VB.Net but should be easy enough to translate to C# (if you're bent that way).
If you know of an easier way please post. Thanks,
Clay
|
|
|
rclayh
Posts: 8
|
Posted: 04/14/2005, 6:15 AM |
|
Error in code this works...
'version 2
Dim RawURL as String = System.Web.HttpContext.Current.Request.RawUrl
Dim KeyReturnString as String = ""
Dim ReturnPage As String
Try
ReturnPage = System.Web.HttpContext.Current.Request.QueryString("ReturnPage")
If ReturnPage.Trim().Length() > 0 Then
'Add the query string part of the RawURL
Dim BreakPoint as Integer = Instr(1,RawURL,"?")
KeyReturnString = Mid(RawURL, Breakpoint + 1)
ReturnPage = ReturnPage & "?" & KeyReturnString
RedirectUrl = (ReturnPage).ToString()
End If
Catch
'ReturnPage not found don't do a dang thing
End Try
|
|
|
|