.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

Issue with new controller method added

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :ASP.Net
I have created an ASP.NET MVC 2 web application that runs beautifull, not a massively complex application, only 2 controllers (Home and Treatment). I have an XML data store that holds page data to be displayed for each of a set of treatments.All pages display exactly as I want them to.I have now added a new controller method for the Treatment controller with the associated XML data and it displays fine in my development environment (displays exactly as I would expect).When I deploy the new XML data and the new TreatmentController.cs file to the new site the link becomes available, but when navigated to I get a 404 page not found exception. All existing links work absolutely fine as they should.The code below shows a working controller method and the controller method that gives the 404 exception, which is pretty much identical, apart from the method and parameter names.public ActionResult Gift_Vouchers(){    GetMasterData(ViewData);    GetTreatmentData("Gift_Vouchers");    return View("Treatment");}//The above method workspublic ActionResult First_Aid_Training(){    GetMasterData(ViewData);     GetTreatmentData("First_Aid_Training");     return View("Treatment");}//The above works in dev environment, fails in liveI would assume that this is something

View Complete Post

More Related Resource Links

Memory Management issue while calling COM method from .Net component

Hi all,  The Com Component Method say(GetChildresponse) requires Byte pointer as input. From .Net Component, while calling GetChildResponse  I am creating IntPtr and passing it to Component.  I am only creating the pointer in my .Net Component but allocation of bytes(CoTaskMemAlloc) happens at COM Method. After populating the pointer buffer, I am transferring to memory buffer in .Net method and Free the memorry of the pointer using "Marshal.FreeCoTaskMem" method.  Still I am not sure, whether it is deallocating the memory since the Garbarge collector wont happen immediately.  We are hitting on performance issue while doing load testing and we suspect this might be due to memory allocation that is not getting deallocated properly. Any pointers would be helpful. Thanks, Nithya Sample Code: unsafe {   // Get the physical memory address ocpHeaderBufferPointer = new IntPtr((void*)&ocpHeaderBufferPointer); temporaryResponseBufferPointer = new IntPtr((void*)&temporaryResponseBufferPointer); }   try {   try {   // Call the GetResponse of the pass through ocpChannel   new OCPChannelDSClass().GetResponse((uint)transactionId, ocpHeaderBufferPointer, out ocpHeaderBufferSize, temporaryResponseBufferPointer, out temporaryResponseBufferSize, (uint)timeout); }   catch (Exception ex) { &nbs

Why request parameter added to client side code in each method while using svcutil.exe

Hi, I am using WCF services in my project and want to call WCF methods asynchronously. I am hosting WCF service programmatically in windows app as follows svc = New ServiceHost(GetType(Service1), New Uri("net.tcp://localhost:8806/")) Dim svcMDB As New ServiceMetadataBehavior svc.Description.Behaviors.Add(svcMDB) svc.AddServiceEndpoint(GetType(Service1), New NetTcpBinding(), "MyBusiness/MyBusinessService/") svc.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexTcpBinding(), "MyBusiness/MyBusinessService/mex") svc.Open() Me.Text = "Service started...." and I am generating client side proxy using svcutil.exe as follows. svcutil /n:net.tcp://localhost:8806/MyBusiness/MyBusinessService,MyService net.tcp://localhost:8806/MyBusiness/MyBusinessService/mex /a /language:vb   The result of this command is as :   Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152] Copyright (c) Microsoft Corporation.  All rights reserved.   Attempting to download metadata from 'net.tcp://localhost:8806/MyBusiness/MyBusi nessService/mex' using WS-Metadata Exchange. This URL does not support DISCO. Generating files... D:\Prabodh\New C2k\Test Projects\DataTableToArray\MyHost\bin\Debug\MyBusinessSer vice.vb D:

Parameter names ending with "specified" added to web service method call

Hello,I am new to WCF. I created a wcf web service and the generated web method exposed by wcf has some additional boolean parameters with names that end with "Specified".I am trying to understand why are these additional parameters necessary and how to get rid of them. Thanks!David

Cascading Dropdown Web Method Issue



I am having an intersting issue to which I have found no solution, obviously. I am using a web service to populate a couple cascading drop downs. Evereything looks correct to me but I am getting a [Method Error 500] when I run it all. I have the <System.Web.Script.Services.ScriptService()> added to the web service so that's not the problem. What I have found while playing with it is that if I remove the arguments from the web method (ByVal knownCategoryValues As String, ByVal category As String) then it works. This of course is not helpful as I am trying to populate multiple drop downs. I can find nothing on anyone else having this issue.

I am using .NET 3.5 and Ajax DLL version 3.02... 

Also of note is that I have another website, using the same .NET and Ajax versions and this code is working fine.

I have tried everything I can think of, including my last resort tactic of smashing my face on my keyboard, and nothing is working. I am at a loss. Any help would be appriciated. Thanks.

Drop Downs:

<asp:DropDownList runat="server" ID="ddlPlateType" Width="250px" />

<ajax:CascadingDropDown runat="server" ID="cddPlateType" TargetControlID="ddlPlateType"

Calling a method on a Web User Control that is added ar runtime


Greetings All!


I have a Web Form that uses Master Pages. I only tell you this part so you understand the layers.


On the page, I have a web user control.  I can see public methods on that user control by simply calling  userControlName.PublicMethod();


However, there is a button on this page which generates additional content.  This content is based on a placeholder control and adding additional web user controls :


private void buildSubForms()
            Control subForm;
            // load in the Lesson Topic Sub Form
            subForm = LoadControl("~/siteAssets/controls/ilasLT.ascx");
            // load in the Reference Material Sub Form
            subForm = LoadControl("~/siteAssets/controls/ilasRM.ascx");


Now, on the main form, I want a submit button that will call a public method of each "subForm" that was added at runtime.


I have tried  various forms of Control C = This.Page.Master.FindControl("cpBody").Findcontrol("ctl01")... etc, but can never seen to get the right combination.

I am sure more info

Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method a


I have just upgraded our web applications to RC1 (please don't change the namespaces again microsoft!), and are getting the following error on one of our pages:

A Runtime Error has occurred.
Do you wish to Debug?

Line: 3088
Error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method.

Has anyone elst seen this error?


Issue After SSP is upgraded in SP2010 by DB attached method


We have upgraded SSP db to SharePoint 2010 successfully.


We got all user profiles including custom properties however the problem is only properties which have choice list that data is missed. What we can do in this case. Please help..


Source domain is different from destination domain.


Issue with dynamic usercontrol loading when using ParseControl() method in VS2008


In the process of migrating an old VS2003 web app to VS2008, I'm running into this issue and haven't been able to find a resolution. 

Sample code:

"Default.aspx" has a PlaceHolder(ToolHeader).  In the Page_Load(), we dynamically load a user control passing in the virtual path to a helper method [public Control ParseUserControl(string virtualPath)].  This reads the content from the physical path, returns a Control from ParseControl() method. 

 I immediately get the following error when I open the default.aspx page in browser.

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 type 'DynamicUC.UcControl'.

Source Error:

 Line 1:  <%@ Control AutoEventWireup="true" CodeBehind="UcControl.ascx.cs" Inherits="DynamicUC.UcControl"  %>

Can't figure out why it can't load the type.  Namespaces are looking right.   I try removing the Inherits="DynamicUC.UcControl" attribut

DataGrid/DataTable: Deleting Added Item Issue



I’ve a DataGrid bound to a DataTable, and I’ve a problem deleting rows programmatically.

If I add a new row (using UI) and I mark the row with an error (using SetColumnError), and press the Delete key, the new row is deleted, everything is ok.

If I delete the new row (with errors) programmatically, the row is deleted, but no rows appear in the grid. There isn’t way to add a new row anymore, the grid has no items.

If I delete the new row (programmatically) and it hasn’t errors everything is ok. The row is deleted, and a new empty row appears in the grid. I can add more rows correctly.

MVC Controller .ajax post wired issue.. - Don't know how to solve - Please help


I am using .ajax Post to submit (not form). I will post code but Here is the scenario:

On a I have a telerik mvc grid which has drop down and a few buttons, plus other grid etc. When press button with Id = "Submit" I am invoking .js function call. In this function, I first loop thro downdown list value and build array of (name/value pair). Than I invoke .ajax which will call Controller action.

In controller action I check following:

- if drop down value is desired value or not.. if not I return Json and display message in pop up and remain on same page.

- If all dropdown value are valid, I make web service call .. if web service response says "action I performed is unsuccessful, I return Json and display message on pop up. On pop up "OK" I navigate to "Home" 

- If web service response says record is valid and action I performed is successful, I need to navigate to "Home". I am not able to achieve that.

Here is sample for .js file:


$(function () {
    $('#btnSubmit').click(function () {


        var grid = $('#TreeGrid').data('tGrid');
        var indexOfIdColumn = GetGridColumnIndexByName(grid, "EntityId");

        var results = new Array();

        $("#TreeGrid tbody > tr, #TreeGrid .t-grid-content tbody > tr").e

Return list of items to a controller method


I have these tables in my database - Presses, Paper, and PressPaperSpeeds:

PressID (PK)

PaperID (PK)

PressPaperSpeedID (PK)
PressID (FK)

SQLCE 3.5 SP2 private deploy method issue

I have a c# application that uses private deploy method with a SQLCE 3.5 SP2. If my application is installed on a machine already having SQLCE 3.5 SP1 installed. It uses the SP1 version in GAC rather then my private deployment. 
Is there a way to force what sqlce version to run? Im my case i want MY SP2 version to run. The problem im facing is http://support.microsoft.com/kb/958478/EN-US. And i dont want the enduser to install sp2 or hotfix since im providing the correct sqlceruntime through my private deployment.
Ive looked into a simalar case, http://stackoverflow.com/questions/1165190/is-there-a-way-to-force-using-a-dll-version, but its the other wayaround :/. The problem seems to be the assemblyversion, its in both SP1 and SP2 for System.Data.SqlServerCe.dll so i cant use his "fix". 
My SqlCe versions:
SP1: 3.5.5692.0
SP2: 3.5.8080.0
Any thoughts suggestions on this issue?

Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

Model View Controller (MVC) for ASP.NET

Model View Controller (MVC) architectures, immediately wonder how the MVC pattern can be applied in an ASP.NET world. This article will demonstrate how the MVC pattern can be applied to an ASP.NET web application and still maintain the basic Microsoft supplied architecture.

IsapiModule Error 500 Issue


I am about exhausted trying to figure out this error:

HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x8007007b

Notification: ExecuteRequestHandler

Module: IsapiModule

Requested URL: http://localhost:80/ReportServer

Physical Path: c:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer

When I enable Failed Request Tracing Rules and view the log output I am supposing that the actual problem is in the 2nd call where there are 2 backslashes before the actual filename in the specified path:


CALL_ISAPI_EXTENSION DllName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\\aspnet_isapi.dll"


MVC2 issue - Stuck. Trying to create a cms with nested partials


I am currently trying to display multiple items on a single page. I am not sure as to how to tackle this. What I have is a database table that has all the page data in. I have this run as a PagesController and this works fine. However what I would like to do is, if say the Products page is selected via the menu, I want to pull back not only the Products page html but also get all the products, and even be able to pull them through via category. I was trying to use a partial view, but I can't get it to work. The same would be for other pages, having partial views to display the other content, ie if Gallery is selected, the page html for Gallery shows and it then can push to a partial view that pulls all the gallery images from the gallery db table and so on. 

Maybe I am tackling this the wrong way. I have the pages stored in the db to allow for a CMS system I have setup. Maybe I need to use models for all the other items(Products, Gallery, Videos and such) and use the partial for the page html?

Any help would be greatly appreciated as I am confused.

Sys.Net.WebServiceFailedException: The server method '' failed with the following error:



Let's say we have 2 time consuming functions, aaa and aaa1 inside a aspx page.

        public static string aaa(int i)
            return i.ToString();

        public static string aaa1(int i)
            return i.ToString();



        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        <span id="displayspan"></span>
        <br />
        <input type="button" value=
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