Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6210673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:12:04+00:00 2026-05-24T06:12:04+00:00

I want to be able to map a path to a different domain but

  • 0

I want to be able to map a path to a different domain but keep the original address in the address bar. Is there a way to code this or is it in IIS. I preferably would like a coded method if possible.

I have a link whose href is like this “http://www.example.com/invproxy.aspx?id=1&batch=1”.
I want to have that map to “http://www.otherdomain.com/Files/TheFileRequest.aspx”.

I generate the path to map to using the querystring of the original request. It works with Server.Transfer or Response.Redirect but i want the address bar to still say the originally requested URL. Is this possible?

Thanks

EDIT: I have solved the issue (probably not the most economical way) but below is the code I am using in the Page_load event of invproxy.aspx

// Just test file, no code to select path yet.
string requestPath = "http://www.otherdomain.com/Files/TestFile.pdf";

// Setup the request for the PDF File
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(requestPath);

// Get the response from otherdomain.com
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();

// Assign the invproxy response the PDF ContentType
Response.ContentType = "application/pdf";

// Get the body of the response in a stream object
Stream s = resp.GetResponseStream();

// Create a byte array to  be read into from the stream
byte[] buffer = new byte[resp.ContentLength];

int position = 0;
while (true)
{
   //Read bytes one by one, slow but causes errors trying to read the whole thing.
   //I need to use chunks here.
   int b = s.ReadByte();
   if (b == -1)
   {
       //This is the end of the stream
       break;
   }
   else
   {
       //Set the byte at the current position to the value just read
       buffer[position] = (byte)b;

       //Advance the position by one.
       position++;
   }
}
//breakpoint debugging
string sa = Encoding.Default.GetString(buffer);

//Write the file to the invproxy response.
Response.BinaryWrite(buffer);

EDIT: Just to the add the finished result, I get my PDF document displayed in a new tab in the browser (where compatible) with the address bar saying http://www.example.com/invproxy?myquerystring

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:12:05+00:00Added an answer on May 24, 2026 at 6:12 am

    Based on the response above, I’d suggest using an IFrame to load the page that you actually want inside of the page whose URL you want the end-user to see. Keep in mind, this may have knock-on effects depending on how complex the contained page is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to do this. MyInterface interface = new ServiceProxyHelper<ProxyType>(); Here's
I want to be able to get an estimate of how much code &
I want to be able to get an estimate of how much code &
I want to be able to map memory to a file descriptor so I
I am searching for a (multi)map where there values are associated by different key
I want to be able to capture the exception that is thrown when a
I want to be able to do: For Each thing In things End For
I want to be able to play sound files in my program. Where should
I want to be able to make an HTTP call updating some select boxes
I want to be able to view a SQL Server 2005 Reporting Services report

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.