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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:52:15+00:00 2026-05-11T15:52:15+00:00

I currently have a login link on my application that looks something like this:

  • 0

I currently have a login link on my application that looks something like this:

<a href='/login?ReturnUrl=' + <%= Request.RawUrl %>>Login</a> 

I want to handle the POST command on the login page in the controller action below:

[AcceptVerbs(HttpVerbs.Post)] public ActionResult Login(string returnUrl) {     // Authenticate user      return Redirect(returnUrl); } 

The problem here is if the RawUrl is something with multiple url parameters like ‘somepage?param1=1&param2=2&param3=3’, then the returnUrl that gets passed into the Login action is truncated after the first ampersand: ‘somepage?param1=1’.

I’ve tried UrlEncoding the RawUrl but that seem to make any difference. It seems that the ASP.NET MVC framework here is UrlDecoding the url params before mapping them to the controller action parameters, which ends up stripping off the additional url parameters I want to see in my returnUrl parameter.

Is there any way around this? I know I could just use Request.Path and parse out the values I need, but I thought I’d see if there was a cleaner approach first.

  • 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. 2026-05-11T15:52:15+00:00Added an answer on May 11, 2026 at 3:52 pm

    You’re probably encoding the links incorrectly. Yes, they do need to be encoded. Here is how we do it:

    <a href='<%= Url.Action('Delete', 'TimeRecord',      new RouteValueDictionary(new { id = timeRecord.AltId,      returnUrl=ViewContext.HttpContext.Request.Url.PathAndQuery }) ) %>'> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, I currently have login/ in urls.py redirect to the django.contrib.auth.views.login and that seems
Currently, in my settings module I have this: LOGIN_URL = '/login' If I ever
I'm currently building my own login script and have noticed that most append the
I have this application that uses custom methods to register and loggin users using
Currently have password protection on my main and sub directories, however I'd like to
I currently have a Gridview , And I want to use client-side validation to
We currently have a .NET 2.0 web app that uses forms authentication via cookies.
I have a web application set up on our intranet that uses windows authentication
I have a mobile web application that uses the Javascript SDK to connect to
I have an issue with my login functionality. When user clicks the logout link

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.