Web application Sharing including ASP, ASP.NET 1.0 (C#) AND ASP.NET 2.0 (C#) MS SQL 2005 Server, Life, Travelling
Monday, August 22, 2011
ASP.NET - new session id when refresh the page
Try to get a session id in default.aspx
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
txtSessionID.Text = this.Session.SessionID;
}
}
when i refresh the page, new session id show. This is weird because it won't happen in Asp.net for dotnet framework 1.1.
To solve the problem, simply add below code in global.asax to register an event handler for the session start event
void Session_Start(Object sender, EventArgs e)
{
}
Tuesday, October 12, 2010
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Server Error in 'xxx' Application.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.] CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +95 CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +271 [Exception: Load report failed.] CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +333 CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +894 CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) +84 Transaction_InvoicePrint.Print() +149 Transaction_InvoicePrint.Page_Load(Object sender, EventArgs e) +5 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627 |
I'm not sure what could cause this issue but after i reset iis, everything work fine.
Tuesday, September 21, 2010
ASP.NET Security Vulnerability: Take Action Immediately
http://info.dotnetnuke.com/rs/dotnetnuke/images/DotNetNuke_Security_Update_Regarding_ASPNET_Vulnerability_091810.pdf
Monday, September 20, 2010
Keep track download in ASP.NET
Tuesday, September 14, 2010
Attempted to read or write protected memory. This is often an indication that other memory has been corrupted.
Hit below error when deploy a new app to existing running application.
Attempted to read or write protected memory. This is often an indication that other memory has been corrupted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Try to set the folder permission but still hit the same error after restart iis.
Next, i try to run the permissions wizard in the IIS. After run it, restart iis and i'm lucky. It work like normal.
Hope this help.
Monday, March 29, 2010
Failed to access IIS metabase. An unhandled exception occurred during the execution of the current web request. Please review the stack ...
Hit below error when try to setup and new application in IIS.
Server Error in '/encelabs' Application.
--------------------------------------------------------------------------------
Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[HostingEnvironmentException: Failed to access IIS metabase.]
System.Web.Configuration.MetabaseServerConfig.MapPathCaching(String siteID, VirtualPath path) +3492170
System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath.MapPath(String siteID, VirtualPath vpath) +9
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +163
System.Web.CachedPathData.GetConfigPathData(String configPath) +382
System.Web.CachedPathData.GetConfigPathData(String configPath) +243
System.Web.CachedPathData.GetApplicationPathData() +68
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +3385679
System.Web.Configuration.RuntimeConfig.GetLKGRuntimeConfig(VirtualPath path) +189
Version Information: Microsoft .NET Framework
Steps:
1. Click on Start -> Run
2. Type in cmd and click OK
3. Command prompt screen will appear. go to"C:\Windows\Microsoft.NET\Framework\v2.0.50727" folder by using command cd C:\Windows\Microsoft.NET\Framework\v2.0.50727 and hit enter. Please refer screen below:
4. Type in aspnet_regiis -i and hit enter.
5. Screen below will be shown and dotnet user installed.
Thursday, March 25, 2010
Could not load file or assembly 'CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependenci
"Could not load file or assembly 'CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified."
This is because we dont have crystal report basic runtime installed in the server.
Where do I get the basic (10.5) runtime? It's on your machine:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5
My server is a 32 bit machine, so i install CRRedist2008_x86.msi in the machine.
Now what? I still can the same error? Wait, we need to restart the IIS to make it work. After restart the IIS, it's work perfectly.
Sunday, March 21, 2010
Parser Error Message: Section or group name 'system.web.extensions' is already defined.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.Parser Error Message: Section or group name 'system.web.extensions' is already defined. Updates to this may only occur at the configuration level where it is defined.
Source Error:
Line 2: |
Source File: C:\Inetpub\wwwroot\xxxxx\web.config Line: 4
Section or group name 'scripting' is already defined. Updates to this may only occur at the configuration level where it is defined. (C:\Inetpub\wwwroot\formlookup_ajax2\web.config line 5) |
Situation:
Monday, March 15, 2010
Exception Details: System.UnauthorizedAccessException: Access to the path C:\xx\aa.xml is denied. ASP.NET is not authorized to access the requested re
Access to the path 'C:\xxx\aa.xml' is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.UnauthorizedAccessException: Access to the path 'C:\xxx\aa.xml' is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
|
Thursday, November 12, 2009
Method not found: 'Void System.Web.UI.ScriptManager.RegisterStartupScript
Thursday, September 3, 2009
The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use .. pool
This may have occurred because all pooled connections were in use and max pool size was reached.
Monday, August 24, 2009
Sys.WebForms.PageRequestManagerServerErrorException: an unknow error occured while processing the request on the server. ..status code returned .. 500
Environment: ASP.NET, AJAX.NET and MySQL DB
I got error return when using one of the form written in AJAX.NET when calling MySQL Stored Procedure
Sys.WebForms.PageRequestManagerServerErrorException: an unknow error occured while processing the request on the server. the status code returned from the server was: 500

Well, after check around i found out that the problem is in the MySQL Stored Procedure case sensitive issue. Change the case and problem solved!
Tuesday, May 19, 2009
MySql.Data.MySqlClient.MySqlException: Table 'xxx.xx_XxxxXxx' doesn't exist
Well, finally find out that it caused by case sensitive on the table name. After i've change the name, it's work perfectly.
Monday, May 18, 2009
Access denied for user 'xxxx'@'xxx.xxx.xxx.xxx' (using password: YES)
Hit error message when try to connect:
Access denied for user 'userxxx'@'xxx.xxx.xxx.xxx' (using password: YES)
It's quite worry because this is first time trying to connect from a .net web application is IIS to MySQL in Linux.
Prior to that, privileges must be granted in MySQL.
______________________________________________
mysql> grant all privileges on *.* to 'userxxx'@'xxx.xxx.xxx.xxx'
identified by 'xxxpasswordxxx' with grant option;
Query OK, 0 rows affected (0.00 sec)
______________________________________________
Finally, found that it's my own mistake. I've put in the wrong username and password. Check your username and password seriously before the connection.
Sunday, August 17, 2008
Tuesday, August 12, 2008
ASP.NET: colon in querystring cause error "is not a valid virtual path."
'~/Search.aspx?pageidx=1&Id=:' is not a valid virtual path.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: '~/Search.aspx?pageidx=1&Id=:' is not a valid virtual path.
Understand that in asp.net, virtual path in the URL with colon (:) is not allowed. To solve this problem, i replace the colon (:) with ASCII value for colon : (please check http://www.asciitable.com/) and HttpUtility.UrlEncode on the search key before pass into search.aspx as querystring.
In Search.aspx.cs, do HttpUtility.UrlDecode and pass to DB for searching purposes. Problem solve. Bear in mind that you might need to disable the ValidateRequest (ValidateRequest="false") which may open for dangerous hijack/request.
Monday, August 11, 2008
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
Server Error in '/xxxxx' Application.
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the
error and where it originated in the code.
Exception Details: System.InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
Source Error:Line 89: <%# if (Eval("UserId").ToString().Length != 0) {%>
googling around and not able to find a solution. What i do is i put the if/else condition into a function and pass in UserId as parameter and output the desire output string.
now my line 89: become <%# FormatRatedDisplay(Eval("UserId").ToString())%> and new function FormatRatedDisplay will return a string. I issue solved.
Monday, July 7, 2008
Retrieve data from DataTable
for (int i = 0; i < MyDataTable.Rows.Count; i++)
{
string score = MyDataTable.Rows[i]["score"].ToString();
xxxxxx
xxxxxx
}
Thursday, July 3, 2008
W3SVC Restart when changing ASP.NET version in ASP.NET tab (IIS)
If anyone face the same or similar issue, maybe can share your solution.
Monday, June 30, 2008
C# String.Format - Input string was not in a correct format Error
below are the code that have problem
info = string.Format("{\"name\":\"{0}\",\"img\":\"{1}\",\"href\":\"{2}\"}", Username, PhotoUrl, UserId);
try to figure out here and there and finally found the problem and solution. It's caused by both { and }.
To solve this problem, change { to {{ and } to }}. It will become
info = string.Format("{{\"name\":\"{0}\",\"img\":\"{1}\",\"href\":\"{2}\"}}", Username, PhotoUrl, UserId);
problem solved!

