ReportDocument rpt=new ReportDocument(); rpt.Load(Server.MapPath("ReqVsCur.rpt")); rpt.SetDatabaseLogon("username","password"); rpt.SetParameterValue("@year",DateTime.Now.Year); MemoryStream oStream; oStream=(MemoryStream)rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel); Response.Clear(); Response.Buffer=true; Response.ContentType="application/vnd.msexcel"; Response.BinaryWrite(oStream.ToArray()); Response.End();
shanthivasan
Posts
-
Export To Excel -
Active Directory Integration using C#.netthanks a lot sathish. I am through.I did a mistake in DirectorySearcher.
-
Active Directory Integration using C#.netthanks for your reply. I checked the name.It is not working. Do i have to use DirectorySearcher to check the user name? All i have to do is that, i have to get the user name who is currently logging in.
-
Active Directory Integration using C#.netI am using VS 2003 .Net framework. I have to integrate the web application with active diretory. I browsed net i found the below code.no luck there. i dont know how to solve the error. void Page_Load(Object Src, EventArgs E ) { if(!Page.IsPostBack) { lblMessage.Text = "use domain\\username format"; } } private void AuthenticateUser(object sender, EventArgs e) { string ldapPath = "LDAP://dc=domain",DC=dn; DirectoryEntry de = new DirectoryEntry(ldapPath); de.Username = txtUsername.Text; de.Password = txtPassword.Text; de.AuthenticationType = AuthenticationTypes.Secure; try { string name = de.Name; //force a bind lblMessage.Text = "Success, You have authenticated"; } catch(Exception ex) { lblMessage.Text = "Failure: " + ex.Message; } finally { de.Close(); } }
User name
password
User name: <%=User.Identity.Name %>
My process is running as: <%=System.Security.Principal.WindowsIdentity.GetCurrent().Name %>I am getting the following exception: Failure: System.Runtime.InteropServices.COMException (0x8007054B): The specified domain either does not exist or could not be contacted at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_Name() at ASP.index_aspx.AuthenticateUser(Object sender, EventArgs e) please advice on this
-
Active DirectoryHi Martin, Thanks for your reply. I just tried to get the Environment.Username. but i am getting the ASPNET as a result. Do you have any code for that? Thanks in advance
-
Active DirectoryI need to retrieve Current (who currently logined to machine) user personal information(like his fullname,address,email id etc.....imaging all those required information is stored in ActiveDirectory) from Active Ditrectory. I am using Visual studio 2003. with thanks and regards
-
datarelation in datasetthis.myDataGrid.DataSource = myDataSet; only the first datatable of the dataset will be assigned to the datagrid if we use the above syntax. But i have to use the datarelation of the dataset. what should do for that? thanks a lot for your response. thanks in advance
-
datarelation in datasetI have created the datarelation from the datatables of dataset. but i don't know how to bind the resultset of datarelation to the datagrid control. please let me know. thanks in advance
-
How to invoke web service method in C#.NetHi, How to invoke web service methods in C#.Net? Thanks in advance
-
How to insert images in MS Access db using C#.netI have to insert images in Access db using C#.net. what datatype should i use to achieve that? Thanks in advance
-
Active Directory And .NETThanks a lot Zion
-
Please help me out : How to convert "CrystalDecisions.Shared.ExportFormatType.PortableDocFormat" to System.IO.MemoryStreamThank you so much for your timely help.
-
Please help me out : How to convert "CrystalDecisions.Shared.ExportFormatType.PortableDocFormat" to System.IO.MemoryStreamI have to export crystal report data into excel.To achieve that, I have written coding like this MemoryStream oStream; oStream=(MemoryStream)(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); Response.clear(); Response.Buffer=true; Response.ContentType="application/pdf"; Response.BinaryWrite(oStream.ToArray()); Response.End(); But i am getting compile-time error such as "Cannot convert type 'CrystalDecisions.Shared.ExportFormatType.PortableDocFormat' to 'System.IO.MemoryStream' " Can anyone help point out what mistake i have done on coding. Thanks in advance Shanthi