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 8911797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:02:06+00:00 2026-06-15T04:02:06+00:00

I am generating a URI as follows (this code is simplified and falsified): Uri

  • 0

I am generating a URI as follows (this code is simplified and falsified):

Uri baseUri = "http://localhost/MyApp/Account/Login";
Uri fullUri = GetFullUri(baseUri, user);

GetFullUri looks like this (this is in a .NET 2 assembly):

public Uri GetFullUri(Uri baseUri, User user)
{
    string token = GetTokenFromUser(user); //Implementation not important.

    //Create a new URI based on the base URI, adding a query string.
    return new Uri(baseUri, string.Format("?Token={0}", token));
}

Calling GetFullUri from a .NET 4 assembly, the result is correct, fullUri looks like:

http://localhost/MyApp/Account/Login?Token=ABC123

Then I called the same exact code from a .NET 2 assembly and the result is incorrect, fullUri looks like:

http://localhost/MyApp/Account/?Token=ABC123

Notice how the .NET 2 result is missing the 4th and final segment, “Login”? What’s the deal with that?

  • 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-06-15T04:02:08+00:00Added an answer on June 15, 2026 at 4:02 am

    Looks like a bug which was fixed in .NET 4.0. Try using the UriBuilder, which works in both:

    public Uri GetFullUri(Uri baseUri, User user)
    {
       string token = GetTokenFromUser(user); //Implementation not important.
    
       var builder = new UriBuilder(baseUri);
       builder.Query = string.Format("Token={0}", token);
       return builder.Uri;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When generating models from postgresql with ColdFusion Illudium Code generator the boolean values get
I'm currently generating the amount of time given the number of seconds. This is
Situation is as follows: There is a separate object that is responsible for generating
I'm generating expiring signed URI's with paperclip on S3. However on every request I
I used an absolute URI for referencing the font file, but I get this
I am dynamically generating an image through code-behind in Silverlight and apparently the image
I am getting this error in my Entity Framework code first application and I
Generating normal columnar data in excel file is quite easy but does any one
While generating an XML content, I get an empty node <node/> , and I
Am generating a hidden fields like so: @helper.input(_form(userID), '_label-> None) { (id, name, value,

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.