CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Interview Success Kit - Get Success in Job Interviews Interview Success Kit - 30,000 Interview Que. & Ans.
Covers 30,000+ Interview Questions asked in actual MNC Interviews - all with model answers.
Get Your Dream Job Now - www.vyoms.com
Sponsored Links
Interview Questions
Our Services

INTERVIEW QUESTIONS MICROSOFT ASP.NET DETAILS
Question :
Can we use http handlers to upload a file in asp.net?


Category ASP.NET Interview Questions
Rating (4.5) By 19 users
Added on 7/27/2011
Views 1054
Rate it!
Answers:

Answer is yes. We can use http handlers to upload a file in asp.net.

To perform file upload in ASP.NET, you need to know two classes: the System.Web.UI.HtmlControls.HtmlInputFile class and the System.Web.HttpPostedFile. The first class represents an HTML control that the user uses to select a file on the client side and upload it. The latter represents the uploaded file itself, and an instance of this class is obtained from the HtmlInputFile control. The next two subsections discuss each class in detail.

<% @ Import Namespace="System.IO" %>
<script language="VB" runat="server">
Sub Page_Load(sender As Object, e As EventArgs)

Dim root As String = "C: emp"
Dim filepath As String = Request.Params("file")
If Not filepath Is Nothing Then
If File.Exists(filepath) And filepath.StartsWith(root) Then
Dim filename As String = Path.GetFileName(filepath)
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", _
"attachment; filename=""" & filename & """")
Response.Flush()
Response.WriteFile(filepath)
End If
End If

End Sub
</script>



If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification Enter the above shown code: *
    Inform me about updated answers to this question

    Related Questions
    View Answer
    What is the exact purpose of http handlers and interfaces?

    View Answer
    What is the difference between excute query and excute nonquery.?

    View Answer
    Difference beetween datagrid and datareader?

    View Answer
    What is the difference between excute query and excute nonquery.?

    View Answer
    Explain Assemblies?,Difference between Panel and GroupBox?,Differences between ASP and ASP.NET?

    View Answer
    What is the trace in ASP.NET

    View Answer
    How do we connect to the 11S if we want to use it instead of the built in Web Server?

    View Answer
    I am searching a record in datagrid.if i enter any value it display record not found,if the record is not there.
    but i enter Apostrophe it is showing error(Cannot perform 'Mod' operation on System.String and System.String)....how to clear this bug.....

    View Answer
    While searching a record in database it accepts all the letters and special characters.but,i enter Apostrophe it is showing error(Cannot perform 'Mod' operation on System.String and System.String) like this...
    how to clear this bug?

    View Answer
    can i assign datagrid.datasource = datareader
    will it work?
    will it fill my datagrid with the values

    View Answer
    What do you mean by authentication and authorization?

    View Answer
    Whats the use of @ Register directives ?


    View Answer
    What are different properties provided by Object-oriented systems ? Can you explain different properties of Object Oriented Systems? Whats difference between Association , Aggregation and Inheritance relationships?


    View Answer
    What is the maximum number of cookies that can be allowed to a web site?

    View Answer
    What is .net frame work?

    View Answer
    What is Reflection

    View Answer
    Whats the significance of Request.MapPath( )

    View Answer
    What are web parts ?

    View Answer
    How to handle the exception occured in catch block? (If a exception occurs in catch block,which statement is executed next?)

    View Answer
    How to compare an xml schema with xml schema?

    View Answer

    Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

    View ALL ASP.NET Interview Questions & Answers

    User Options
    Latest 20 Questions
    How to Retrieve a Cookie Value ?
    How to Create a Cookie?
    What is ViewState ?
    What are different methods of session maintenance in ASP.NET?
    What is cross cutting concern and concern in spring AOP ?
    What are the important beans lifecycle methods ?
    Explain the advantages of using DAO module?
    What is SQLProvider ?
    How struts application can be integrated with spring?
    What are the advantages of spring framework?
    What is ?Throws advice? in Spring ?
    What is Metadata Autoproxying ?
    Describe about DAO in Spring framework ?
    What is called an Advice ?
    What is IOC?
    What are the types of Dependency Injection?
    What are the different Modes of Autowiring ?
    Define Application context module?
    Why Spring framework is needed?
    What is called Spring MVC?


    Copyright ©2003-2016 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions

    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | C Interview Questions & Answers

    Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes


    Cache = 0.539062 Seconds