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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:18:04+00:00 2026-06-08T07:18:04+00:00

I need to assign filename name variable to hidden field value in ashx page,

  • 0

I need to assign filename name variable to hidden field value in ashx page, how can I assign value to hidden field in ashx page?

.ashx page

public void ProcessRequest(HttpContext context)
{
    var file = context.Request.Files[0];
  //here i need to pass this file name in hidden field value
}

This is aspx page where hidden filed present

  <asp:HiddenField ID="hdnFileName" runat="server"/>
  • 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-08T07:18:07+00:00Added an answer on June 8, 2026 at 7:18 am

    (Unless I’m very much mistaken..) ASHX is a webservice, not some code-behind.
    If you want to get the value of that field, you need to post your form to the corresponding URL of the .ASHX file, or use AJAX.

    If you want to return data, I advise you to use AJAX.

    EDIT: According to MSDN, my statement is correct. .ASHX is ment for HttpHandlers that do not have a UI.

    Generic Web handler (*.ashx) The default HTTP handler for all Web
    handlers that do not have a UI and that include the @ WebHandler
    directive.

    Example of how to post with AJAX:

    $(function(){
        $.ajax({
                url:'location of your ashx goes here',
                type: 'post',
                success: function(data){
                $("#hdnFileName").val(data);
         }
    };
    

    Your ASHX would return the data:

    public string ProcessRequest(HttpContext context)
    {
        var file = context.Request.Files[0];
      //here i need to pass this file name in hidden field value
        return fileName;
    }
    

    note: see also https://stackoverflow.com/a/8758614/690178 for uploading files using AJAX.

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

Sidebar

Related Questions

I need to assign my variable to session. I tried this: string name =
I often need to assign a variable, if the source value is set. So
I need to assign a variable which will be used to create the id
A TreeNode class has Text Name Tag I need to assign more values to
I need to get UserCarId(int) from this query and assign to int type variable.
I need to assign 2,554,416,000 to a variable. What would be the primitive to
I need to assign constant value in integer (or other data type). I got
I need to assign javascript client Date (examp. - 2012/02/03 16:00:00) to php variable.
We need to assign the Name property at the runtime using the data binding.
I need to assign channel for each schedule. There can be as many concurrent

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.