Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.NET/VB Redirect URI cannot contain newline characters

Posted on 2006-06-19
4
Medium Priority
?
422 Views
Last Modified: 2008-01-09
hi,I am having a problem of redirecting when the user presses the Enter key as one of the things in the remarks textbox. When the user hits enter key I want to just ignore and submit whatever is keyed in. How do I do that?

Dim query As String = Request.Url.Query.Substring(0, Request.Url.Query.LastIndexOf("&"))

query += "&remarks=" & Trim(remarksTxt.Text)
query = "monthLyreport.aspx" & query
Response.redirect(query)


somebody recommended this b4 redirecting.....
query = HttpUtility.UrlEncode(query)

but this results in my URL being
monthLyreport.aspx%3fA%3dABC%26B%3dABC%26C%3d6%26D%3d06%26remarks%3dhaha

instead of
monthLyreport.aspx?A=ABC&B=ABC&C=6&D=06&remarks=haha

i.e
? is replaced by %3f
& is replaced by %26
= is replaced by %3d

Thanks in advance
0
Comment
Question by:obajaber
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 16940537
hai,
Use Server.UrlEncode method

Dim query As String =Server.UrlEncode( Request.Url.Query.Substring(0, Request.Url.Query.LastIndexOf("&")) )

query += "&remarks=" & Server.UrlEncode(Trim(remarksTxt.Text) )
query = "monthLyreport.aspx" &Server.UrlEncode(query )
Response.redirect(query)

regards
pradeep
0
 

Author Comment

by:obajaber
ID: 17138708
Wait, I tried the above solution. It was of no help, It still couldn't work. However, a friend recommended using he approach below: it worked.

'for the sending page
            Dim bQuery As Byte()
            Dim sQuery As String
            bQuery = Encoding.ASCII.GetBytes(Trim(remarksTxt.Text))
            sQuery = Convert.ToBase64String(bQuery)
            query += "&remarks=" & sQuery
            query = "monthlyReport.aspx" & query
            Replace(query, "", "%20")
            Response.Redirect(query)
'for the receivng page
  Dim bQuery As Byte()
        Dim sQuery As String = "None"
        If Request("Remarks") <> "" Then
            bQuery = Convert.FromBase64String(Request.QueryString("Remarks").ToString)
            sQuery = Encoding.ASCII.GetString(bQuery)
        End If
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 17160209
PAQed with points refunded (30)

DarthMod
Community Support Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question