Solved

passing and retrieving target url

Posted on 2009-07-09
6
452 Views
Last Modified: 2013-11-18
Here is my problem..

I need to update an xml feed url attribute on the fly, with a new url using the old url as the target,

like this
original url, http://www.somesite.com/?someparam=this&anotherparam=that
new url redirect.aspx/?target=http://www.somesite.com/?someparam=this&anotherparam=that
in the redirect page i need to retrieve the target URl append some more veriables and then redirtect.

i think i can do the replacing in the XSLT without a hitch I need to now the syntax for passing the target URL though.

I also want to confirm this is valid, as the resulting URL will end up with 2 ? in it, and how would i collect the full url in C# when i try and retrieve it, as the url has parameters of its own
Thank you
0
Comment
Question by:QuinnDester
[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
  • 5
6 Comments
 
LVL 12

Assisted Solution

by:GuitarRich
GuitarRich earned 500 total points
ID: 24813092
when you add the URL to your parameter you will need to encode it for http and decode it when you retrieve it in the redirect page. The HttpUtility class has methods for doing this.

e.g:

string originalUrl = @"http://www.somesite.com/?someparam=this&anotherparam=that";
string newUrl = string.format("redirect.aspx//?target={0}", HttpUtility.UrlEncode(@"http://www.somesite.com/?someparam=this&anotherparam=that"));
 
// To retrieve it
string url = HttpUtility.UrlDecode(Request.QueryString["target"].ToString());
Response.Redirect(url);

Open in new window

0
 
LVL 3

Author Comment

by:QuinnDester
ID: 24813213
I cant do that, i dont have access to the URL in the code behind untill after it is passed.

the URL comes directly from an xml feed which is transformed through my xslt file and out put directly to the page in html, i can added the redirect.aspx?target= to the start of the url.

Unless there is a way of encoding the url in XSLT while it is being transformed?
0
 
LVL 3

Author Comment

by:QuinnDester
ID: 24814026
A thought, if i used a form button for the link on the web page could i pass the url as the value and have the redirect as the action.

if so how would i go about building a form button in  XSLT ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:QuinnDester
ID: 24830102
I have created the form button in XSLT and it dispalys fine when testing it, but when the transformed html is displayed within the contentplaceholeder of my web page i get inconsitant result.
everything is in the page 8 times out of 10 refreshes only the first product of 20 is showing, the rest are  not showing, like they have been changed to the same color as the background.

the other 2 times they show correctly.
0
 
LVL 3

Author Comment

by:QuinnDester
ID: 24835541
I have found another way to do this, by URL encoding the URL within the xslt and passing it as a target tribute on the url.

I would still like to know if picking up a hidden field value from a plain html page is possible in .net
as this would come in very handy if it is, so will leave this question open for now.
0
 
LVL 3

Accepted Solution

by:
QuinnDester earned 0 total points
ID: 24894676
closing this question, will raise it again if the need arises
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

734 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