.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

[MVC 3 Beta] The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(S

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :ASP.Net


I'm trying to use the Zippy helper (http://www.weirdlover.com/2010/05/

10/zcontroller-asp-net-mvc-controller-fo-your-scripts-styles-images/) to compress, cache, and unify my javascripts and stylesheets with MVC 3 beta (using Razor engine) but on this line:
I always have this error:
Compiler Error Message: CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments

can you help me?

View Complete Post

More Related Resource Links

CS1502: The best overloaded method match for 'System.Web.UI.WebControls.TableCellCollection.this[in


 Argh... I'm learning how to utilize my codebehind for more, and am stuck trying to figure out who to get to the labels that are in a gridview from my codebehind, and keep getting this error... 


in my .aspx, I have this as part of my gridview 

<asp:Label ID="lblSubSectionName" runat="server" Text='<%# Bind("SubSectionName") %>'></asp:Label>
and, here's my code behind that I thought would get this label..


The best overloaded method match for... has some invalid arguments

I have a compilation error generated by this scenario: i have : 1. DataAccessLayses 2. Entity 3. PresentationLayer(web application)4. BankServices(web service) inside the webservice i have one web method with argument of my pre-defined class library it name is CustomerEL and the class in PresentationLayer calling the webservice method ,CustomerEL cusE = new CustomerEL();objsv.addCustomer(cusE);(addCustomer(<argument>) is method in BankServices)  and here the eror occuredcan you help me !Regards

Crystal Report gives System.AccessViolationException: Attempted to read or write protected memory. T


when a crystal report for same id is opened again at same time or refreshed then it gives the

"System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

Stack Trace is :-

Stack Trace:

[AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.]
CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.SetConnectionInfos(ConnectionInfos ConnectionInfos) +0
CrystalDecisions.CrystalReports.Engine.Table.ApplyLogOnInfo(TableLogOnInfo logonInfo) +362
CrystalDecisions.CrystalReports.Engine.ReportDocument.SetTableLogon(Tables tables, String user, String password, String server, String database, Boolean ignoreCase) +258
CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDatabaseLogon(String user, String password, String server, String database, Boolean ignoreCase) +204

Is it possible to write the same encrypt and decrypt method that in MembershipProvider


Hi, I am very confused about encrypting and decrypting password.

What I did is that, I am using a class that extends SqlMembershipProvider, and when I need to encrypt a password, just called base.EncryptPassword() method to do so.

But still, I did not get to know how things are done here, and I really would like to know its codes.

Can anyone provide the code for me please?


AjaxToolkit's CascadingDropDown control is throwing Method Error 404 in Hybrid system environment (

Hi Experts, We have an Asp.net web application, which is deployed in shared hosting environment. On shared hosting environment initial request to this web application is handled by Linux server and then based on the requested page the Linux server is redirecting request to web server on windows OS. Now, in our web application, we have used ajaxToolkit's CascadingDropDown control to populate three levels of categories. In the hybrid system described above, the CascadingDropDown control is throwing Method Error 404. I would appreciate if some body can guide on how to resolve this issue. The sample of code snap shot is mentioned below. ********************************************************************* Aspx file. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <asp:DropDownList ID="ddlMajorLevelCategory" runat="server" Width="250px" ToolTip="Select Major Level Category" TabIndex="1"                            SkinID="h6BlueArial"> </asp:DropDownList>   <ajaxToolkit:CascadingDropDown ID="ccMajorCategory" runat="server" TargetControlID="ddlMajorLevelCategory" Category="M" PromptText=&qu

How write new method for .Net Objects

This might be a very basic question.Like thisDataRow1["ColumnName"].ToString();How can I DoDataRow1["ColumnName"].ToInt();I don't want to use Convert.ToInt / Have my own static Utitlity class and pass the value to it and get value.In  other words would I create new method  for .net objects?Thanks In advance

Static Method System.Convert.ToDateTime() throws a FormatException on Windows7

Hello, There is a strange bug with the method System.Convert.ToDateTime(). Trying this simple statement Convert.ToDateTime("10/9/2010 17.39"); on a windows vista/xp works and the conversion is done. If you try that on a windows 7 than you get a format exception. Anybody has this problem? https://connect.microsoft.com/VisualStudio/feedback/details/597405/static-method-system-convert-todatetime-throws-a-formatexception-on-windows7#details Best regards. Thank you.

Problem with overriding OnPaint method of System.Windows.Forms.Textbox

Hi,   I want to change the border colour of the Textbox. However, when I override the OnPaint method, some strange behaviour occurs.   The new border is drawn, as is the textbox background. However, the text itself appears in bold and only while I actually type something in, afterwards it disappears. I have provided a sample of my code here:         protected override void OnPaint(PaintEventArgs e)         {             base.OnPaint(e);             Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);             ControlPaint.DrawBorder(e.Graphics, rect, _BorderColour, ButtonBorderStyle.Solid);         }   I have also set the style of the control to Userpaint, so that the paint method is actually used. Does anybody know how to solve this issue?

Weird Exception: Method not found: 'Double System.Windows.Controls.ScrollViewer.get_ContentHorizon

Hi guys I have an XBAP application that uses a Xamdatagrid from Infragistics. I have some filtering on this grid, that rebinds after a filter. The problem is, when a user has scrolled to a certain point and then filters, the rebinding causes the grid to scroll to the beginning position of the grid. Now how I solve this is by getting an instance of the ScrollViewer, I get the ScrollViewer.ContentHorizontalOffset and then I do a ScrollViewer.ScrollToHorizontalOffset after it filters.   Now here comes the problem. For 99% of the users of this xbap app, this will work absolutely fine. Most, if not all of the users run exactly the same machines, XP 64 bit with 8GB RAM. The other 1% get the error: Method not found: 'Double System.Windows.Controls.ScrollViewer.get_ContentHorizontalOffset()'. I cannot reproduce this error on my own box, our dev server or our production server, it is a phantom exception that only pops up on a certain condition. I have even wrapped the "offending" code in a try catch and it still doesn't solve it. If I set the DispatcherUnhandledExceptionArgs Handled to true, it works, but it doesn't feel right. How is this possible? If the method doesn't exist, how can it compile? Why does that method exist for 99% of the other users running the exact same machines? I have googled my fingers raw without any valid results and this issue is frustrat

EXPERT: Method error 500 in dropdown (solution is NOT adding System.Web.Script.Services.ScriptServic


Please only answer if you have read the full question!!

Ok...this thing is driving me crazy!!!!

I keep getting a method error 500 in my dropdown box.

All the posts on the web come with the same solution, but it doesnt work for me!
The code seems SO simple and consists of so few lines....but it just doesnt work!



<asp:DropDownList ID="ddlCountries" runat="server">

<cc1:cascadingdropdown ID="cddCountries" runat="server" Category="Country" Enabled="True" LoadingText="Loading...please wait." PromptText="Choose a country" ServiceMethod="GetCountries" ServicePath="geolocation.asmx"     TargetControlID="ddlCountries"></cc1:cascadingdropdown>

<%@ WebService Language="VB" CodeBehind="~/App_Code/geolocation.vb" %>

<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
 Public Class geoloc

TCP Client/Server communication: NetworkStream.Write() send partial data unless close() method is re

Hi to all,
I wrote a simple client-server application that comunicate through NetworkStream class. The problems comes when stream.close() and client.close() methods are called. It look like only the first 10415 bytes are sent once those methods are called. So, if the data to send is more than this size, it is automatically truncated.

If I  remove both stream/client close() methods from the code, the data is fully received whatever the size is. I tried various alternative solutions (the ones marked as comments in the sample code), but none of them works.
The only thing that seems to work is adding a manual delay before the close() methods execute with something like that:

For Counter as integer = 0 to 10

The problem is that after delay I still don't know if all the data has been transfered or not. In addition to that, I will have to wait 10 seconds before sending another request, even if the response is just a few bytes of data. I could change at runtime the number of seconds to wait according to the size of the data to send, but I still think that delay is not a solution and will cause adverse effects.

So, for now the only working solution is to remove both Stream/Client Close() methods from

System.Net.Mail ignores Sender address when delivery method is SpecifiedPickupDirectory


Has anybody else had an issue with the sender address not being used as the return-path/bounce address when using system.net.mail to send email with a different address for the return-path/sender and the from address and using the SpecifiedPickupDirectory delivery method? This issue is particularly important when you need to send mail from a "user" address, but want bounce backs to come to a different address so they can be processed.

Using the code below, I think you can reproduce the issue.

Imports System.Net.Mail
Partial Class emailtest
    Inherits System.Web.UI.Page

  Protected Sub test_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles test.Click

    ' Build Message
    Dim mail As New MailMessage
    mail.From = New MailAddress("from@domain.com")
    mail.Sender = New MailAddress("sender@domain.com")
    mail.Subject = "Test Subject"
    mail.Body = "Test Body"

    ' Drop in Pickup Directory
    Dim smtpPK As New SmtpClient
    smtpPK.DeliveryMethod = SmtpDeliveryMethod.Sp

How do I write System::StartTime to a table?



I am trying to very simply insert the System::StartTime into a file.

I have placed a watch on this system variable the contents of this system variable within a watch appear valid, e.g. ; -

SYSTEM::STARTTIME {18/10/2010 14:30:27} DATETIME

I created an Execute SQL Task.

I mapped the variable name SYSTEM::STARTTIME  as a parameter within a data type of DBDATE.

Entered the SQL Statement; -


INTO dbo.CustomSSISLog (StartTime)

Write Unit Test for method with parameter


I'm trying to build my first MVC site and also write unit test for the first time.  I can't figure how to write unit test for methods that take parameters.  How do I write a test method for this controller action?

public class CustomerController : Controller

        public ActionResult Details(int id)
            var customerDetails = (from c in _entities.Customers
                                  where c.PK == id
                                  select c).FirstOrDefault();

            return View(customerDetails);


System.Web.Mvc.HtmlHelper' has no applicable method named 'RenderPartial'



I am trying to convert some repetitive html into a user control.  Here is the HTML :

                    <tr><th class="teamheader">WEEK</th><th class="teamheader">OPPONENT</th><th /><th class="teamheader">RESULT</th></tr> 
                    <% foreach (var item in this.Model)
                       { %> 
                            <td class="teamgrid"><%= Html.Encode(item.Week) %></td>
                            <td><img src='<%= Html.Encode(item.Image) %>' alt="Logo" /></td>
                            <td class="teamgrid"><%= Html.Encode(item.Opponent) %></td>
                            <td class="teamgrid"><%= Html.Encode(item.Result) %></td>
                    <% } %> 
                </table><br />
It works fine like this, but I cannot successfully transfer this over to a user control, as I get the error in the subject title.  Here is my user control :
<%@ Control Langu

System.IO.Packaging.Package commit-write issues


Hi all, I'm experiencing what seems a timing issue using the Package class. I have an editor which allows users to edit some parts in an OPC package. Wherever an edit operation is required, I apply a lock to a readonly non static member of the editor class, create a new package controlling its lifetime with "using", do my stuff and then let the package instance call Dispose and commit any edit. This works fine, but it fails when I repeat this operation quickly: it looks like the OS is still committing the pending changes in the package file, while it is newly opened for the subsequent edit. For instance if I quickly remove say 10 items in a part with an items collection, at the eleventh deletion I get an index out of range exception, as if the application and the underlying package file were no more in synch. If I do the same operations in the same order, but not as quickly as before, everything works fine.

My code is like:

lock (_objPackageLock)
 using (Package package = Package.Open(Source, FileMode.Open, FileAccess.ReadWrite))
  ... do my edits ...

where _objPackageLock is an instance member of the editor class:

public class TheEditorClass
  private readonly _objPackageLock = new object();

Locks are there for th

The security accessibility of the overriding method must match the security accessibility of the met




I am faced with the infamous exception "Inheritance security rules violated while overriding member : Security accessibility of the overriding method must match the security accessibility of the method being overriden" exception in my project. I think I understand security transparency level 2 and when this message is supposed to occur, and what is necessary to fix the problem. However, as far as I know, the problem should not occur here because the security attributes of the overriden method does match the ones from the base method.



Indeed, I have a class inheriting MarshalByRefObject and overriding InitializeLifetimeService. This is the method triggering the exception but it is correctly annotated with the SecurityCriticalAttribute to match the base method's security accessibility.

public abstract class DisposableMarshalByRefObject : MarshalByRefObject, IDisposable 
   public override object InitializeLifetimeService() 
     return null;


I have two projects : a class library where DispposableMarshalByRefObject is declared and a console application for testing purposes. The console application i

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend