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
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