views:

40

answers:

4

Hello, I'm creating an html page that is posted to another page for processing. I don't want users to see the weird URL they are redirected to and I was using FRAMES but I can't figure out how to add my HTML page dynamically because I need the variables and either add frames or try another way to accomplish this. So, based on how I'm creating the page below, how can I hide the URL and add something that I want.

Here is how I'm creating the page.

StringBuilder sb = new StringBuilder();
    sb.Append("<html><head></head>");
    sb.Append("<body onload=\"document.frmLaunch.submit();\">");
    sb.Append("<form name=\"frmLaunch\" action=\"" + variableTargetURL + "\" method=\"post\">");
    sb.Append("<input type=hidden name=\"testVariable\" value=\"" + variableTest + "\">");
    sb.Append("</form>");
    sb.Append("</body></html>");
    HttpResponse response = HttpContext.Current.Response;
        response.Clear();
        response.Write(sb.ToString()); response.End();
A: 

You have url rewriting as a tag - is setting up your web.config and using asp.net url rewriting (as you are using asp.net and C#) the answer?

amelvin
+1  A: 

If you're doing the redirect on the server, Server.Transfer will not update the URL in the browser on the client.

Russ Cam
A: 

If this is ASP.Net 3.5 or later try ASP.Net Routing. It's not just for MVC applications.

Otherwise, checkout your list of options in the article Tip/Trick: Url Rewriting with ASP.NET.

The heart of most of the rewrite engines out there is the HttpContext.RewritePath() method. I've used this method directly in HttpApplication_BeginRequest() and it works well on it's own. So you can take that approach as well.

kervin
A: 

I went with just creating the page inside the frame.