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


Top 5 Contributors of the Month
Sharon Maxwell
Post New Web Links

async call problem mvc asp.net

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :ASP.Net
 

 I read this article, so i write a small code like below in VS 2010:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace AsyncMVC.Controllers
{
    [HandleError]
    public class HomeController : AsyncController
    {
        public void IndexAsync()
        {
            AsyncManager.OutstandingOperations.Increment(2);
            MyTimer timer1 = new MyTimer();
            timer1.FirstEvent += (sender, e) =>
            {
                AsyncManager.Parameters["intid"] = e.id;
                AsyncManager.OutstandingOperations.Decrement();
            };
            timer1.Start1();

            MyTimer timer2 = new MyTimer();
            timer2.SecondEvent += (sender, e) =>
            {
                AsyncManager.Parameters["stringid"] = e.id;
                AsyncManager.OutstandingOperations.Decrement();
            };
            timer2.Start2();

        }

        public ActionResult IndexCompleted(int intid, string stringid)
        {

            return View();
        }

        public ActionResult About()
        {
            return View();
        }
    }

    public class MyEventArgs1 : EventArgs
    {
      


View Complete Post


More Related Resource Links

Problem in Routing WCF Service call from another WCF Service

  
Dear All,
           I have few WCF Services hosted on a remote machine which access my remote DB.
I call the services from my windows application and everything works like a charm.

           Now I want to make the above service calls from machines which will not have internet.
But they will be on LAN where atleast one PC will have a active internet connection.
So I created another WCF service which is hosted on a Windows service on the internet enabled machine. I've added all the service referance in the new service and any service withoute any parameters work fine.

           But when I try to send any data as parameter I get error

"There was an error while trying to serialize parameter http://tempuri.org/:obj. The InnerException message was 'Type 'Consume_Win_WPF_Service.LOginService.ClsMessage' with data contract name 'ClsMessage:http://schemas.datacontract.org/2004/07/LoginService' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details."

Can anyone tell me what steps I should impliment to en

WCF async call return a 10054 error: "An existing connection was forcibly closed by the remote host"

  

Hello!

I have a WCF consumed by a Windows Mobile 5.0 or above application with .NET Compact Framework 2.0 SP2 and C#.

When the application consume a asynchronous "method" it throws that message. This is also the stackTrace of inner exception:

at System.Net.Sockets.Socket.ReceiveNoCheck()
at
System.Net.Sockets.Socket.Receive()
at
System.Net.Connection.Read()
at
System.Net.HttpWebRequest.fillBuffer()
at
System.Net.HttpWebRequest.getLine()
at
System.Net.HttpWebRequest.parseResponse()
at
System

Problem filling labels with table data outside datalist using single call to db

  

On a single page, I'd like to fill 2 hyperlink controls as well as a datalist control with table data using one call to the database. The page looks like this:

<div id="PageContent">    
    <h2>
      Districts</h2>
    <p>
      Please select the district you wish to view below.</p>
    <p>
      <asp:DropDownList ID="ddlDistrict" runat="server" CssClass="textbox" 
        DataTextField="DistrictName" DataValueField="DistrictId" AutoPostBack="True" 
        onselectedindexchanged="ddlDistrict_SelectedIndexChanged">
      </asp:DropDownList>
    </p>    
    <p><asp:label ID="lblDistrictAbbrev" runat="server" Text="District Abbreviation: " />
      <asp:hyperlink ID="hyperlinkDistrictName" runat="server" 
        Text='' NavigateUrl="~/Contact/NationalCouncil.aspx" 
        Font-Bold="True" />
    </p>
    <p><asp:label ID="lblDistrictCouncillor" runat="server" Text="District Councillor: " />
      <asp:hyperlink ID="hyperlinkCouncillor" runat="server" 
        Text='' NavigateUrl="~/Contact/NationalCouncil.a

Synchronous call fails, async OK

  

I am using SQL Server 2008 R2 as distrbution server and publication server.

Sql 2008 R2 express as subscription database

Replication is working from the SSIS interface and when using RMO and the SynchronizeWithJob method is used from a VB dotNet interface

When I try to use the SynchronizationAgent.Synchronize() method I get this error message:

The merge process detected a mismatch while evaluating the subscriber partition validation expression. The problem can be resolved by reinitializing the subscription.

It fails at the last line in the following code segment

Here is the code:

subscription =

New MergePullSubscription()

subscription.ConnectionContext = conn

subscription.DatabaseName = subscriptionDbName

subscription.PublisherName = publishe

Problem with asynchronous call to webservice

  

Hello people.

I have a website where i call function in a web service. I am calling it asynchronously. The problem is the data which is returned from webservice is not shown in my label.

See here

protected void Page_Load(object sender, EventArgs e)
{
IAsyncResult asyncResult;

AsyncCallback callback = new AsyncCallback(MyCallBack);
asyncResult = serv.BeginGetImageList(req, callback, null);
}

private void MyCallBack(System.IAsyncResult asyncResult)
{

Label1.Text = "TEST";

}

Very simple but when the page is loaded, the label dont have any text.


Please help.


Problem in firefox and safari to call ajax method?

  

why does my below method not work with firefox and safari, every time it goes on OnFailed method?

is there setting requirement in browser to call page Method ?

also In IE method is calling sucessfully, but why alert message does not come ?

function SendMessage() {
      var user = document.getElementById('<%=User.ClientID %>');
      var val = user.value;
      var random = 2345;
      var nonRandom =12345;
        var toAddress = val;
        PageMethods.SendResetMailMessage(toAddress, random, nonRandom, CloseWindow, OnFailed);
    }


    function CloseWindow(ret) {
      // Below code is usedOnClick="OnForgotPassword_Click" to close the window, if mail has been sent to the user sucessfully.
      if (ret == "1") {
        alert(ret);
        var windowObj = window.self;
        windowObj.opener = window.self;
        windowObj.close();
   

Problem Java call .NET webservice.

  

I created a very simple webservice (below)

namespace PmtCommu

{

    [WebService(Namespace = "http://tempuri.org/")]

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

    [System.ComponentModel.ToolboxItem(false)]

    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 

    // [System.Web.Script.Services.ScriptService]

    public class PmoWebService : System.Web.Services.WebService

    {

        [WebMethod]

        public string PmoSvc_Test(string strVal)

        {

            string retVal = string.Format("You sent me {0}.", strVal);

            // my code logging the strVal.

            return retVal;

}

I tested with .NET client. NO problem.

BUT, my service need to be consumed by Java client. I have trouble passing the parameter in.

I can see the "You sent me ." in my log and as a return value.

Following is the Java Code:

im

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

Using jQuery to directly call ASP.NET AJAX page methods

  
Here I am looking to explain how to call page methods using jQuery. Using jQuery to directly call ASP.NET AJAX page methods

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

Problem to group radio button across gridview rows

  
In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Regrading Sharpoint 2010 problem and solutions

  
http://emanonsolutions.blogspot.com/
We can write your question and problem on this blogger.you get ans.use.

This sharpoint 2010 problem solving threads

  
Hi friend,

you can use this thread to solving problem and solutions.

How to call an .exe file in .net

  
Sometimes a developer has to call an EXE from another EXE. While calling EXE there can be a requirement to pass parameter.

Virtual Path Problem

  

 I get the following error on last line below (working on remote host): 'E:\web\sfcascom\ls_admin/uploads/images/001.JPG' is not a valid virtual path,

Note that the slashes go in different directions

I've tried a number of things but nothing seems to work. Thanks-

 

Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Web.UI.WebControls

Imports System.Drawing.Imaging.ImageCodecInfo
Partial Class Protected_imageupload
    Inherits System.Web.UI.Page
    Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        ' Initialize variables
        Dim sSavePath As String
        Dim sThumbExtension As String
        Dim intThumbWidth As Integer
        Dim intThumbHeight As Integer
        Dim sFilename As String = ""
        ' Set constant values
        'sSavePath = "images/"
        sSavePath = Server.MapPath("~/") + "ls_admin/uploads/images/"



        sThumbExtension = "_thumb"
        intThumbWidth = 160
        intThumbHeight = 120

        ' If file field isn?t empty
        If FilUpload.PostedFile IsNot Nothing Then
            ' Check file size (mustn?t be 0)
            Dim myFile As Http

Strange Photo upload problem

  

I'm working project it's live on shared hosting

we'er uploading photos to a file on the server everything works fine the photo is resized renamed and sent to the folder

the upload page returns the thumbnail and the full size photo it's there all the photos have to be approved by an admin

twice now after they have been approved they disapear I checked the folder they are not there could there be anywhere

on the server they could get hung up before they go into the folder I have it setup so when you delete the data base entry it deletes the photo from the folder othe than that you need to open the folder and delete the photo this has hapened twice now I tried to recreate it with no luck

thaks for your help in advance


ASP.Net Caching problem ??

  

I'm having a problem with an asp.net 3.0 application using a gridview to display data.  The problem seems to be that despite a brand new .selectCommand being sent to the sqlDataSource, the gridview starts displaying data from *someone else's* query.  For example, user A is logged in and will be working fine until a few page submissions later when the gridview data starts suddenly showing information that belongs to another user. 

This is my first asp.net application, though I've been working with classic asp and ADO for years so I'm used to sending a SQL string and getting back the results from that string.  Apparently there is a complex caching system which is interferring which I do not at all understand so at this point I just want to stop the server from caching any data whatsoever.  Is this possible?

Any and all help will be much appreciated!!


Categories: 
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