Pages

Search This Blog

Monday, December 31, 2007

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31b...

Facing issue when my team member try to upload compiled source code from her development machine to new production server.

Server Error in '/' Application.

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: Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error:

</httphandlers>
<httpmodules>
<add type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="ScriptModule">
</httpmodules>
</SYSTEM.WEB>




I've facing this issue before here. Anyway, here is how the problem can be solved.
  1. Copy AjaxControlToolkit.dll and AjaxControlToolkit.pdb version 1.0.61025.0 from my development machine to my ASP.NET App bin folder. (i install my AjaxControlToolkit in C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\AjaxControlToolkit)
  2. Copy System.Web.Extensions.dll (C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions) and System.Web.Extensions.Design.dll (C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions.Design) from my development machine to my ASP.NET App bin folder.
Done.

Sunday, December 30, 2007

New Year Resolution - Happy New Year 2008

"We will open the book. Its pages are blank. We are going to put words on them ourselves. The book is called Opportunity and its first chapter is New Year's Day."
-Edith Lovejoy Pierce-

Wednesday, December 19, 2007

CS0103: The name 'User' does not exist in the current context

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: CS0103: The name 'User' does not exist in the current context

Source Error:
Line 6: <tr>
Line 7: <td colspan="2" align="center">
Line 8: <=User.Identity.Name %>
Line 9: </td>
Line 10: </tr>


Above is the error that i face when compiling my application.
To solve it, change <%=User.Identity.Name %> to <%=Page.User.Identity.Name %>

Sunday, December 16, 2007

Only one instance of a ScriptManager can be added to the page.

Error message "Only one instance of a ScriptManager can be added to the page." when trying to access my web application. Compiled have no error.



The reason for this error is i have include more than one (my case is two) ScriptManager in the same page. In my case in master page and in another page (login.aspx) that include master page.

To solve it, simple remove the ScriptManager in login.aspx. Problem solved.

Saturday, December 15, 2007

Retrive ASP.NET Object value using javascript

I have a checkbox name Checkbox2 runat server, if we try to get value by calling ID= Checkbox2 using javascipt, javascript error: Object not found, this is because server side ID is different with the client side ID. Client side ID for this object is Checkbox2.ClientID.

For example, i need to pass Checkbox2 value to a javascript function during page load, this is what i do.

protected void Page_Load(object sender, EventArgs e)
{
Page.RegisterStartupScript("Onload", "<script language='javascript'>fnCheck('" + Checkbox2.ClientID +"');</script>");
}

fnCheck is a javascript function that i already define some where.

Sunday, December 9, 2007

Test your connection

Most of the time, we are interested to check our MAX Download/Upload speed (commonly referred to as Bandwidth). Here have a very good site to let us to test on it in different country

http://www.dslreports.com/speedtest?more=1

Thursday, December 6, 2007

Shrinking the Transaction Log

Most of the time the transaction log file growth to very huge size until your harddisk not able to take it. What can i do is shrinking the log file.

Remember: Always take full backup before this activity.

There are few ways to do this but i like to use detach and attach method. You can choose whether using enterprise manager or T-SQL. I like to use T-SQL.

t-sql
  • sp_detach_db [dbname]
  • Delete the disk log file.
  • sp_attach_single_file_db [dbname], [filename]where [filename] is the name of the physical data file (.mdf).






Example:
I have a database name RatePost and the .mdf and .ldf physical location
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\RatePost.mdf
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\RatePost_log.ldf

  1. Open my enterprise manager and open a new query window.
  2. Type sp_detach_db RatePost in the query window and run the script
  3. Go to "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\" and delete RatePost_log.ldf
  4. Clear the query window and type
    sp_attach_single_file_db RateMyPosts, 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\RatePost.mdf' and run the script
  5. After you have run your script, you can see in Message window
    File activation failure. The physical file name "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\RatePost_log.ldf" may be incorrect.
    New log file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\RatePost_log.ldf' was created.

Now you go to check your log file size reduce and back to around 500Kbyte.

Done.