prob forms authentication while generating excel report

R

Raghavendra

hi,

we r using forms authetication.

problem :- i am using the below code to generate excel report
but since we r using forms authetication.. after generating excel report the
browser directs to login.apsx which is specified in web.config file.

this code is in one file.aspx

In web.config , i specified <identity impersonate = true />


public void Convert(DataSet ds , HttpResponse response )

{

//first let's clean up the response.object

response.Clear();

response.Charset = "";

//set the response mime type for excel

response.ContentType = "application/vnd.ms-excel";

//create a string writer

System.IO.StringWriter stringWrite = new System.IO.StringWriter();

//create an htmltextwriter which uses the stringwriter

HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);

DataGrid dg = new DataGrid();

dg.DataSource = ds.Tables[0];

dg.DataBind();

dg.RenderControl(htmlWrite);


//all that's left is to output the html

response.Write(stringWrite.ToString());

response.End();

}





Raghavendra
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top