1. Detected Request. Form values that are potentially dangerous
Cause:
(1) The validateRequest attribute is not correctly set on the data submission page or webconfig.
(2) Two <form>
Solution:
Solution 1: add this sentence to the. aspx file header: <% @ Page validateRequest = "false" %>
Solution 2: Modify the web. config file:
<Configuration>
<System. web>
<Pages validateRequest = "false"/>
</System. web>
</Configuration>
Because the default value of validateRequest is true. Set it to false.
2. "An invalid read attempt is made when no data exists" SOLUTION
Cause:
The returned sqldatareader does not have a data record, but does not perform record judgment. Null Value returned
Add judgment: if (reader. read () {TextName. Text =
Reader ["FieldName"]. ToString ();}
3. The data is empty. This method or attribute cannot be called for null values.
Cause:
If the object is null, the method of calling the object, for example, ToString (), must have an error. Generally, the value of the database field is null.
Data controls such as grideview often appear
Solution: Therefore, it is recommended to perform NULL processing.
4. The FieldCount attempt is invalid when the reader is disabled.
Cause:
After SqlDataReader is used to bind data, the connection object is closed ().
Similar
Public SqlDataReader GetSomething ()
{
Conn. open ();
SqlDataReader reader =
Sqlcmd. ExcecutReader (CommandBehavior. CloseConnection ));
Conn. close (); // occur error here
Return reader;
}
This method is called during binding to specify the data source. If you use this method, you need to disable Re in the call function.
In this way, the conn can be automatically disabled.
If SqlDataAdapter and DataSet are used, remove the explicit call to disable conn. Or in finally
.
5. The path cannot be mapped.
Cause: it may be because the path configuration in webconfig is incorrect. This problem is prominent in FCKEditor configuration.
<Add key = "FCKeditor: BasePath" value = "~ /Admin/fckeditor/"/>
<Add key = "FCKeditor: UserFilesPath" value = "/UserFiles/"/>
6. Unreachable code detected
Cause:
Generally, throw or return is used for exception handling or return values. It may be that the position is put in front, resulting in subsequent code execution.
Solution:
Put the throw or return statement to the last row of the agent.
7. The index is out of range. Must be non-negative and smaller than the set size
Cause:
(1). DATAKEYFIELD is not set to the unique field corresponding to the database (generally the primary key)
(2). Maid> e. Item. Cells
Solution:
(1). Set datakeyfield
(2) Add the judgment statement maid. count (datagrid can be another similar Server Control)
8. Error: Part of path "C: \" is not found.
Note:
An error occurred while executing the current Web request. Check the stack trace information for details about the error and the source of the error in the code.
Exception details: System. IO. DirectoryNotFoundException: Part of the path "C: \" is not found.
Solution:
Adding the Users Group read permission to drive C can be accessed. However, due to server security issues, the UserS group permissions should be removed. Successive problems are shown in different error methods, as mentioned below, we will solve the problem one by one.
9. The data source does not support data paging on the server.
Solution:
Do not use DataReader, instead use DataSet: or use custom paging mode. Do not use the paging function provided by vs.net.
OleDbDataAdapter da = new OleDbDataAdapter (SQL, connection );
DataSet ds2 = new DataSet ();
Da. Fill (ds2, "News ");
GridView1.DataSource = ds2;
GridView1.DataBind ();
10. The object name '*****' is invalid.
Cause: the current database does not have the *** table, or the current database connection account does not have the operation permission for this object.
Solution: solution to cause 1: Check whether the name of the called table is incorrectly written in the program or whether the SQL database contains the table cause 2 you called: change the owner of all objects in your database to dbo.
Solution (this solution comes from the network and is effective after experiments) as follows:
Use your account to connect to the query analyzer and run the following SQL statement:
You can use sp_changedbowner to change the database owner.
Method 1: Right-click the table and choose design table from the shortcut menu. In the previous small icon, click the last "condition constraint" and click the "table" page to change the owner. (If there is no small icon with constraints, you can right-click to see a "check constraint" option)
Method 2: Execute the script directly, log on to the database with a system account or a super user, and then execute the following statement:
Sp_configure 'Allow updates', '1' go reconfigure with override go update sysobjects set uid = 1 where uid <> 1 go sp_configure 'Allow updates ', '0' go reconfigure with override/* batch replacement
Declare tb cursor local for select 'SP _ changeobjectowner '[' + replace (user_name (uid), ']', ']') + ']. ['+ replace (name,'] ','] ') +'] '', ''dbo' 'from sysobjects where xtype in ('U ', 'V', 'P', 'tr ', 'fn', 'if', 'tf') and status> = 0 open tb declare @ s nvarchar (4000) fetch tb into @ s while @ fetch_status = 0 begin exec (@ s) fetch tb into @ s end close tb deallocate tb go
*/
11. An error occurred while establishing a connection with the server. When connecting to SQL Server 2005
If the Server does not allow remote connection, this may fail. (Provider: named pipeline provider,
Error: 40-unable to open the connection to SQL Server)
Solution: fixed IP addresses or server addresses are required on the host.
12. SqlDateTime overflow. It must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
This problem occurs. ''most of the reason is that when you update the database, ''datetime field value is blank'' is inserted on January 1, January 01, 0001 by default.
'''Causes datetime type Overflow
13. ------- indicates "attribute". Here it should be "method"
Cause:
1. the attribute formats of VB and c # are different.
2. It may be caused by an error in the syntax of Binding data to design: 1. Remember to use the [] Method for attributes ()
2. Remember the correct syntax for binding data (there are several methods: <% Container. DataItem ("field name") %> <%
# Eval ("field name") %> <% Bind ("field name") %>)
14. Failed to import from assembly "DAL, Version = 1.0.0.0, Culture = neutral,
PublicKeyToken = null "loads data type" DAL. SqlHelper ".
Cause: failed to recompile to dll after modifying other layers
Solution: Compile (Rebuild)
15. Too many parameters are specified for a process or function,
Solution: number of parameters used to call the stored procedure and the defined stored procedure or the parameters passed in the executed SQL statement
Inconsistent numbers (this is an SQL error)
Solution: carefully check the parameter variables set in the stored procedure, and check whether they correspond to the actual input parameter values one by one.
16. debugging cannot be started, and the binding handle is invalid.
Cause: the system's Terminal Services is not enabled
17. Unable to debugging on the web server. Debug failed because integrated windows authentication is not enable
Solution:
Open vs2005-> Tools-> Option-> debug-> Edit and Continue-> tick all
18. The file name or class name cannot be found in the Automation operation: 'regexp'
Solution: regsvr32 vbscript. dll
19. System. NullReferenceException: object reference is not set to the instance of the object.
Cause:
(1) If the set variable is null or the value is not obtained, this problem usually occurs when the parameter is passed, or when data controls such as datagrid, gridview, or datalist are used.
(2) The Control name does not correspond to that in codebehind.
(3) The new initialization object is not used.
(4) The control referenced in the program does not exist.
Solution:
(1) Use try... catch... finally to catch errors, or directly use response. write () to output the value of the variable.
(2) check whether there are uninitialized variables in the code
20. Error 1718. File is denied by the digital signature policy (when vs2005sp1 is installed) solution:
(1) Click Start, click Run, type control admintools, and click OK ".
(2) double-click "Local Security Policy ".
(3) Click "Software Restriction policy ". (Note: If the software restrictions are not listed, right-click "Software Restriction Policy" and click "new policy ". )
(4) Under "Object Type", double-click "force ".
(5) Click "All Users except the local administrator" and then click "OK ".
(6) restart the computer.
Microsoft notes:
Http://support.microsoft.com/kb/925336