By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,320 Members | 2,109 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,320 IT Pros & Developers. It's quick & easy.

prob forms authentication while generating excel report

P: n/a
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
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.