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

  • Home
  • SEARCH
  • 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 660963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:12:55+00:00 2026-05-13T23:12:55+00:00

We’re building an application that is a Silverlight client application, but we’ve created an

  • 0

We’re building an application that is a Silverlight client application, but we’ve created an MVC controller and a few simple views to handle authentication and hosting of the Silverlight control for this application. As part of the security implementation, I’ve created a custom Authorization filter attribute to handle this, but am getting some unexpected results trying to properly handle redirection after authentication.

For example, our Silverlight application’s navigation framework allows users to deep-link to individual pages within the application itself, such as http://myapplicaton.com/#/Product/171. What I want, is to be able to force a user to login to view this page, but then successfully redirect them back to it after successful authentication. My problem is with getting the full, requested URL to redirect the user to from within my custom authorization filter attribute class.

This is what my attribute code looks like:

public class RequiresAuthenticationAttribute : FilterAttribute, IAuthorizationFilter
{
    protected bool AuthorizeCore(HttpContextBase httpContext)
    {
        var cookie = Cookie.Get(SilverlightApplication.Name);

        if (SilverlightApplication.RequiresLogin)
        {
            return 
                ((cookie == null) ||
                 (cookie["Username"] != httpContext.User.Identity.Name) ||
                 (cookie["ApplicationName"] != SilverlightApplication.Name) ||
                 (Convert.ToDateTime(cookie["Timeout"]) >= DateTime.Now));
        }
        else
            return false;
    }

    public void OnAuthorization(AuthorizationContext filterContext)
    {
        if (filterContext != null && AuthorizeCore(filterContext.HttpContext))
        {
            var redirectPath = "~/login{0}";
            var returnUrl = filterContext.HttpContext.Request.RawUrl;
            if (string.IsNullOrEmpty(returnUrl) || returnUrl == "/")
                redirectPath = string.Format(redirectPath, string.Empty);
            else
                redirectPath = string.Format(redirectPath, string.Format("?returnUrl={0}", returnUrl));

            filterContext.Result = new RedirectResult(redirectPath);
        }
    }
}

So in this case, if I browse directly to http://myapplicaton.com/#/Product/171, in the OnAuthorize method, where I’m grabbing the filterContext.HttpContext.Request.RawUrl property, I would expect it’s value to be “/#/Product/171”, but it’s not. It’s always just “/”. Does that property not include page level links? Am I missing something?

  • 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-13T23:12:56+00:00Added an answer on May 13, 2026 at 11:12 pm

    The # sign in URLs (also called the fragment part of an URL) is only used by browsers to navigate between history and links. Everything following this sign is never sent to the server and there’s no way to get it in a server side script.

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

Sidebar

Ask A Question

Stats

  • Questions 350k
  • Answers 350k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Typically such restrictions are configured on the server side. SQL… May 14, 2026 at 7:02 am
  • Editorial Team
    Editorial Team added an answer Because the &* cancels each other out. * dereference d… May 14, 2026 at 7:02 am
  • Editorial Team
    Editorial Team added an answer First of all, ping can't use the HTTP-protocol, you can… May 14, 2026 at 7:02 am

Related Questions

We are developing a little application that given a directory with PDF files creates
We have been using CruiseControl for quite a while with NUnit and NAnt. For
We have a requirement in project to store all the revisions(Change History) for the
We have a remoting singleton server running in a separate windows service (let's call
We have an SVN repository running on a Windows server, and I want to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.