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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:16:24+00:00 2026-05-29T05:16:24+00:00

A client application is uploading an audio file in chunks to an MVC3 site.

  • 0

A client application is uploading an audio file in “chunks” to an MVC3 site. A client uses HttpWebRequest POST to do it.

On the server, I have the following controller action:

  [Authorize]
  [HttpPost]
  public JsonResult RecieveChunk(string id, [ModelBinder(typeof(AudioChunkModelBinder))] byte[] audio)
        {
            //Process chunk

            var chunk = new AudioChunk
            {
                ThoughtId = Guid.Parse(id),
                Data = audio
            };

            //Process chunk by BL

            return new JsonResult {Data = "Success"};
        }

Currently, a built-in AspNetMemebershipProvider is handling the authorization, so the client app has to first authenticate at the logon page, obtain cookie into a CookieContainer and then make a call to a server to upload a chunk of data.

I want to allow clients to also be able to anonymously upload audio files to the server, without a need to previously register. They the client app code will provide the same guid each time the file is uploaded from the same device.

I want both categories of users to share the same RecieveChunk action to do it. But they must be authrized either anonymously (with just guid), or with the logon/pass combination.

Can I have two different controllers linked to two different authentication providers? The third controller, that has [Authorize] marked action, will allow action if either one provider has given a user a cookie (or some other auth method).

Is it possible in general in ASP.NET MVC3?

  • 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-29T05:16:24+00:00Added an answer on May 29, 2026 at 5:16 am

    As discussed in comments you can create a custom implementation of the FilterAttribute class and implement the IAuthorizationFilter interface. For example here is the ChildActionOnlyAttribute implementation:

    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
    public sealed class ChildActionOnlyAttribute : FilterAttribute, IAuthorizationFilter
    {
      public void OnAuthorization(AuthorizationContext filterContext)
      {
        if (filterContext == null)
          throw new ArgumentNullException("filterContext");
        if (!filterContext.IsChildAction)
          throw Error.ChildActionOnlyAttribute_MustBeInChildRequest(filterContext.ActionDescriptor);
      }
    }
    

    And here is the RequireHttpsAttribute implementation:

    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
    public class RequireHttpsAttribute : FilterAttribute, IAuthorizationFilter
    {
      public virtual void OnAuthorization(AuthorizationContext filterContext)
      {
        if (filterContext == null)
          throw new ArgumentNullException("filterContext");
        if (filterContext.HttpContext.Request.IsSecureConnection)
          return;
        this.HandleNonHttpsRequest(filterContext);
      }
    
      protected virtual void HandleNonHttpsRequest(AuthorizationContext filterContext)
      {
        if (!string.Equals(filterContext.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase))
          throw new InvalidOperationException(MvcResources.RequireHttpsAttribute_MustUseSsl);
        string url = "https://" + filterContext.HttpContext.Request.Url.Host + filterContext.HttpContext.Request.RawUrl;
        filterContext.Result = (ActionResult) new RedirectResult(url);
      }
    }
    

    So you could do something like:

    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
    public sealed class CustomAuthorizeAttribute : FilterAttribute, IAuthorizationFilter
    {
      public void OnAuthorization(AuthorizationContext filterContext)
      {
        if (filterContext == null)
          throw new ArgumentNullException("filterContext");
    
        var guidPresent = CheckForGuid();
    
        if (!filterContext.HttpContext.User.Identity.IsAuthenticated && !guidPresent)
          throw new InvalidOperationException("Must authenticate properly")
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am uploading audio file in chunks from a Windows Phone client to an
I have a e-radio into my site The uploading from audio room to server
I have client application that uses WCF service to insert some data to backend
i have a server - client application that runs on java 1.3; i want
I have a .NET client application that needs to communicate with a server using
We have a client application that needs to send messages to a server for
I have a server application and a client application. I'm using socket to communicate
I have a .net client application which is connected to a remote database. Is
We have a desktop client application developed in Swing. This application interacts with backend
I have C# Client application calling Windows webservice written in WCF calling Sql Procedure

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.