Click here to Skip to main content
16,012,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,

Can any one suggest me, what are all Namespace and C# coding that we need to use for Response.clear().

I am using Windows Application using C# coding.

Now I am getting the error "The name 'Response' does not exist in the current context", so can any help me fix this error .

The Mentioned Coding that i am Using to download few data's into a file .

C#
Response.Clear();
           Response.Buffer = true;
           Response.AddHeader("content-disposition","attachment;filename=OutPut"+ System.DateTime.Now+ ".csv");
           Response.Charset = "";
           Response.ContentType = "application/text";


C#
Response.Output.Write(dt.ToString());
            Response.Flush();
            Response.End();
Posted
Updated 15-Dec-11 23:27pm
v3
Comments
thatraja 16-Dec-11 5:25am    
Why do you want that?

It means that you haven't defined Response within the method or class, and it can't otherwise fine a definition for the variable in any of the available namespaces.

Chances are that you need to pass a parameter, but it's impossible to tell because we don't know what your code looks like.
 
Share this answer
 
Comments
SARAVANAKUMAR.M 16-Dec-11 5:45am    
Hi John,
Thanks for your information , but i don't know how to define the RESPONSE in class and what are all namespace that i have to declare in WINDOWS APPLICATION if i need to add that web controls of Responce & Request.
I hope that Request and Response can be used only in web development. Please tell me the reason for using Response.clear() in widows..
 
Share this answer
 
Comments
Amir Mahfoozi 16-Dec-11 5:28am    
+5
Balakrishnan Dhinakaran 16-Dec-11 5:42am    
Thank you Amir
SARAVANAKUMAR.M 16-Dec-11 5:30am    
Ya , i agree that , but i am using it here to download the data's into a file , that's why i am using the Coding's

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900