|
seemamltn wrote: How can I do that.
Maybe by posting it to the correct forum. Try SQL / ADO / ADO.NET
only two letters away from being an asset
|
|
|
|
|
Hello all,
I have a small site that needs to hit Active directory. I added a project reference to my website for System.DirectoryServices. I also added a using statement to the code behind page as you would normally expect. Now, however, I get an error when I try to run a page that is dependent on a file in App_Code that references the System.DirectoryServices assembly. Even though the assembly is referenced by the project, it still isn't picking up the reference for the items in App_Code. Any ideas?
Thanks,
Will
|
|
|
|
|
What error it says when you run your application?
Regards,
Satips.
|
|
|
|
|
Whoops. I guess I should have included that information:
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?)
Source Error:
Line 8: using System.Web.UI.WebControls.WebParts;
Line 9: using System.Web.UI.HtmlControls;
Line 10: using System.DirectoryServices;
Line 11:
Line 12: namespace PearWeb.App_Code
Source File: c:\SVN\PEAR\Source\PearWeb\App_Code\ADHelper.cs Line: 10
|
|
|
|
|
Just Remove the Reference from that folder and once again add the reference to that folder and try again.
Regards,
Satips.
|
|
|
|
|
|
Assembly references are added to projects, not folders.
only two letters away from being an asset
|
|
|
|
|
|
The strange thing (to me, at least), is that the error is a compilation error. Since the System.DirectoryServices dll is in the GAC, it looks like it would be trivial to retrieve from a web application for compilation purposes. I also tried adding a line in the <assemblies> key of the web.config, but I only succeeded in making the app crash earlier, as it says it can't load the assembly at all. The odd thing is that I can use exactly the same code in a web page, and there is no problem at all.
|
|
|
|
|
Ok.... I fixed it, but I don't understand why my fix worked. I set Copy Local on the reference to true. Then, I rebuilt and suddenly it works. Ummmm....Why?
|
|
|
|
|
When I said that it works, I meant that it doesn't blow up. However, the stuff in App_Code is no longer accessible from the rest of the project. I think I might do better to just switch over to a web application project or something.
This makes me want to switch over to ROR instead of bothering with C#, as it seems that I'm spending more time trying to make Visual Studio play nice than I am actually coding. It's hitting the point that it would be an improvement for me to just develop using a terminal and a text editor, which is what I use in Ruby.
Visual Studio 2005 reminds me of Rain Man a little more every time I use it. Sure, it can do impressive stuff that others can't do without a lot more work, but it has an apoplectic meltdown if you don't buy your underwear at Target.
|
|
|
|
|
Can Crystal Report show dynamic picture?
Is anyone know?
thank you
|
|
|
|
|
Use a typed DataSet, put the graphic in the DataSet and use the DataSet as DataSource for the Crystal Report.
So we can make it as Dynamic.
Hope this will help you.
Regards,
Satips.
|
|
|
|
|
Hi, I've found the function below when I was searching for ways to prevent SQL Injection. Basically it is supposed to remove the words select, drop, inser, delete, and other characters that can affect your database. I'm new to VB.NET and ASP.NET so please bear with me.
function killChars(strWords)
dim badChars
dim newChars
badChars = array("select", "drop", ";", "--", "insert", "delete", "xp_")
newChars = strWords
for i = 0 to uBound(badChars)
newChars = replace(newChars, badChars(i), "")
next
killChars = newChars
end function
I get the error message "array is a type and can not be used as an expression". I also noticed that the datatype for the variables badChar and newChars were not specified and VS2003 says the variable "i" in the for loop was not declared. I have seen vb.net For loops used the way its being used in the function above without generating errors. Please help clarify, thank you in advance for your help.
|
|
|
|
|
If you want to prevent SQL injection attacks then don't accept SQL statements period, use store procedures or parameterized queries.
only two letters away from being an asset
|
|
|
|
|
Use Stored Procedure.
Then you will not get these error.
Regards,
Satips.
|
|
|
|
|
Gee, wish I had said that...oh I did, 1 hour 20 minutes ago.
only two letters away from being an asset
|
|
|
|
|
LOL - yeah, I sometimes give an answer where the correct answer has been given, but I feel I can expand on it. Some people seem to just reiterate answers tho, some posts get 6 or 7 answers, all the same, hours apart. Go figure
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Helloo Iam delpoy my web application(asp.net 2.0)
and gives following error
is it possible that bcz the server dont support .net 2.0
???????
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load the assembly 'WebSite8_deploy'. Make sure that it is compiled before accessing the page.
Source Error:
Line 1: <%@ page language="C#" autoeventwireup="true" inherits="Default3, WebSite8_deploy" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Source File:-----\test\Default3.aspx Line: 1
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2379; ASP.NET Version:1.1.4322.2379 <<<<------------------- look here
aj123
|
|
|
|
|
Well - does the server have .NET 2.0 installed? Would seem like an obvious requirement to me....
|
|
|
|
|
I have ported my Visual Studio2003/asp.net 1.1 web application on to Visual Studio 2005/asp.net2.0 platform. One page of this web application behaves strangely. On the home page of the application there is a head control and footer control. This user controls have links which allows users to go to various pages upon clicking. All except one link somehow behaves differently. This link however upon clicking opens up correctly the page but on clicking any button or even doing selected item change on drop down box on the page displays error like “Internet Explorer cannot display the webpage” and under what you can try section it lists Diagnose Connection Problem and More Information. If I try to browse this site on development machine I get an error “The page can not be displayed” and “cannot find Server or DNS Error”. The server on which this web application is deployed is Virtual Machine having Windows 2003 sever with IIS 6.0 and asp.net 2.0 and .Net Framework 2.0.
Can any one please shed light how to solve this problem?
I would like to thank you in advance for your help.
Bharat Gadhia
|
|
|
|
|
The links point to the wrong URL. Check what url is in the browser address bar when you get these errors.
|
|
|
|
|
Thank you for your reply.
This error also occurs even while changing selection in drop down box.The same link works fine in Visual Studio 2003/asp.net 1.1 enviornment.
Bharat Gadhia
|
|
|
|
|
I have code that calls a report (report service 2005) that I have to put into a web service and then stream to a client app (vb - asp.net). The code that runs the report, gets and displays the report fine if I place it on a regular aspx page but I can't figure out how to put it in a web service and stream it to a client for consumption.
The following code will display the report:
Response.ClearContent()
Response.AppendHeader("content-length", result.Length.ToString())
Response.ContentType = "application/PDF"
Response.BinaryWrite(result)
Response.Flush()
Response.Close()
and this will write it to a file:
Dim stream As System.IO.FileStream = System.IO.File.OpenWrite(fileName)
stream.Write(result, 0, result.Length)
But how to I do this as a web method?????
Full code is below:
---------------------------------------------------------------------------
Imports System.IO
Imports System.Web
Imports System.Net
Imports System.Web.Services
Imports System.Web.Services.Protocols
<webservice(namespace:="ggmitg.servicesbus")> _
<webservicebinding(conformsto:=wsiprofiles.basicprofile1_1)> _
<global.microsoft.visualbasic.compilerservices.designergenerated()> _
Public Class ServicesBus
Inherits System.Web.Services.WebService
<webmethod()> _
Public Function GetReport() As String
Dim rs As RptSrv2005.ReportingService2005
Dim rsExec As RptExec2005.ReportExecutionService
'create new proxy to the web service
rs = New RptSrv2005.ReportingService2005()
rsExec = New RptExec2005.ReportExecutionService()
'authenticate to the web service using windows credentials
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials
'assign the url of the web service
rs.Url = "http://192.168.248.12/ReportServer/ReportService2005.asmx"
rsExec.Url = "http://192.168.248.12/ReportServer/ReportExecution2005.asmx"
'prepare render arguments
Dim result As Byte() = Nothing
'Dim reportPath As String = "/AP Recovery Audits Reports/VendorsStatus "
Dim format As String = "PDF"
Dim historyID As String = Nothing
Dim devInfo As String = "<deviceinfo><toolbar>False"
Dim extension As String = Nothing
Dim encoding As String = Nothing
Dim mimeType As String = Nothing
Dim warnings As RptExec2005.Warning() = Nothing
Dim streamIDs As String() = Nothing
'define variables needed for GetParameters() method
Dim reportName As String = "/AP Recovery Audits Reports/VendorsStatus"
Dim forRendering As Boolean = False
Dim values As RptSrv2005.ParameterValue() = Nothing
Dim credentials As RptSrv2005.DataSourceCredentials() = Nothing
Dim parameters As RptSrv2005.ReportParameter() = Nothing
'other parameters
'Dim fileName As String = "c:\testreport.pdf"
'Dim fileName As String = "c:\test.data" 'file to hold binary data
Try
'see if any parameters are needed
parameters = rs.GetReportParameters(reportName, historyID, forRendering, values, credentials)
'load selected report
Dim execInfo As New RptExec2005.ExecutionInfo
execInfo = rsExec.LoadReport(reportName, historyID)
'set the parameters needed for the report.
Dim params(0) As RptExec2005.ParameterValue ' = New RptExec2005.ParameterValue
params(0) = New RptExec2005.ParameterValue
params(0).Name = parameters(0).Name
params(0).Value = "140"
rsExec.SetExecutionParameters(params, "en-us")
result = rsExec.Render(format, devInfo, extension, encoding, mimeType, warnings, streamIDs)
'output the file
'Response.ClearContent()
'Response.AppendHeader("content-length", result.Length.ToString())
'Response.ContentType = "application/PDF"
'Response.BinaryWrite(result)
'Response.Flush()
'Response.Close()
'create a file stream and write the report to it
'Dim stream As System.IO.FileStream = System.IO.File.OpenWrite(fileName)
'stream.Write(result, 0, result.Length)
???????????????????
How do I stream output to a consumer app
???????????????????
Catch ex As Exception
'Response.Write(ex.Message)
End Try
'Return "Hello World"
End Function
End Class
|
|
|
|
|
Hello, I'm new to ASP.NET. I 've ben a C# programmer for about a year, but I'm just touching on the realms of web development.
Anyhow... I'm having a problem. Everytime I try to compile and run my page, I get the following message: "CS0117: 'ASP.index_aspx' does not contain a definition for 'MyScript'"
This is the code on my page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="C#" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<link rel="stylesheet" type="text/css" href="default.css" />
<script type="text/c#" id="MyScript">
private void MyFunc(object sender, EventArgs e)
{
TextBox1.Text = "Test";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Button runat="server" Text="Button" id="Button1" onClick="MyScript.MyFunc()"/>
<asp:TextBox runat="server" id="TextBox1" MaxLength="10" Rows="1" Columns="10"/>
</form>
</body>
</html>
If it helps any, I'm using Microsoft Expression Web, because I don't have anything else other than C# Express (No asp.net support)
I'd appreciate any help.
|
|
|
|