I am trying to use ajax in my view in order to update changes in users profiles. Unfortunately, whatever I try, I get the error message "Error!!!". I think the problem is my model, and I have tried to customize it, but it still does not work.

Here is the JS that is executed when the user pushes the "save" button:

$(document.getElementById('save')).on("click", function() {
            var liSportMotives = $('#sortable li').map(function(i, n) {
                return $(n).attr('id');
            }).get();
            var liActivities = $('#myCarousel div').map(function(i, n) {
                if ($(n).hasClass('thumbnailActive')) {
                    return $(n).attr('id');
                }
            }).get();
            var myPostJSONObject = {
            Weight : parseFloat($(document.getElementById('weightrange')).val()).toFixed(1),
            Height : parseFloat($(document.getElementById('heightrange')).val()).toFixed(2),
            IsSportsBeginnerPractise : $("input:radio[name='IsSportsBeginnerPractise']:checked").val(),
            IsSportsBeginnerKnowledge : $("input:radio[name='IsSportsBeginnerKnowledge']:checked").val(),
            IsNutritionBeginnerPractise : $("input:radio[name='IsNutritionBeginnerPractise']:checked").val(),
            IsNutritionBeginnerKnowledge : $("input:radio[name='IsNutritionBeginnerKnowledge']:checked").val(),
            NewSportMotives : liSportMotives,
            NewActivities : liActivities
        };
            $.ajax({
                url: '@Url.Action("ManageConfirmation", "Account")',
                type: "POST",
                traditional: true,
                data: JSON.stringify(myPostJSONObject),
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                success: function (data) {
                    alert("Success!");
                },
                error: function () {
                    alert("Error!!!");
                }
            });
        });

My model in my controller looks like this:

public class ManageUserDetails
        {
            public decimal Height { get; set; }

            public decimal Weight { get; set; }

            public bool IsSportsBeginnerPractise { get; set; }

            public bool IsSportsBeginnerKnowledge { get; set; }

            public bool IsNutritionBeginnerPractise { get; set; }

            public bool IsNutritionBeginnerKnowledge { get; set; }

            public String[] NewSportMotives { get; set; }

            public String[] NewActivities { get; set; }
        }

And I have an action that looks like this:

    public ActionResult ManageConfirmation(ManageUserDetails model)
    {
        return RedirectToAction("Index", "Home");
    }

In Asp.Net MVC, we need to show a Html page, but also when that page shows, download a file too as the result of a form post.

Is there a kind of ActionResult that both renders HTML, but also cause the browser to download a file? Think of a page that shows "Here's your requested file" and the file starts to download.

Basically a combination of ActionResult and FileResult in one.

I have three model classes.

public class Tournament{
   public int ID{get;set;}    
   public string Title{get;set;}    
}

public class Team{
  public int ID {get;set;}    
  public string Name {get;set;}    

  public int ID {get;set;}    
  public Virtual Tournament tournament {get;set;}    
}


public class Match{
  public int ID {get;set;}    
  public string Place{get;set;}   
}

Relationships:

  1. One to Many relationship between Tournament and Team.
  2. Many to Many relationship between Team and Players.

Query Result.....

I want linq query that display the match details in the following format... based on the Tournament ID

Date Place Team1 Team2

Please answer my question. Thanks

I'm new to Java and new to Rx. I'm in at the deep end. I'm at very early stages of writing an android app that will use an MVC (Model-View-Controller) pattern and I'm experimenting with various ways of doing that, in particular RxJava. My idea is to make my Model an Observable and my View the Observer. The model (or a wrapper class) would then emit a new copy of the model each time its data changes. In .net I'd be thinking about using INotifyPropertyChanged.

I think I need to implement a custom Observable - but how? There's plenty of documentation about how to convert collections into observables, but this doesn't fit my use-case as I don't have a collection - just a single item, the data model. Is there a way to do this? Remember I'm developing for Android so I can't use lambdas or anything fancy like that.

I have a textbox on my view and I'm only looking it to display the current date and time(in readonly..how can this be done?

Currently I have this in the view:

    <div class="editor-field">
        @Html.EditorFor(model => model.Opened, new { @value = System.DateTime.Now, @readonly = "readonly" })
        @Html.ValidationMessageFor(model => model.Opened)
    </div>

..And this in the model:

    [Required]
    public DateTime Opened
    {
        get;
        set;
    }

How can this be implemented in MVC?

Thanks,

the links are suddenly not working on our umbraco project. All links (umbraco links that is, like @Model.Url, not hard coded links) are not working, and just points to "localhost:8080".

I got a error, complaining about null-pointer exception at this code:

namespace Sk.Web.Routing
{
    public class ExternalUrlProvider : IUrlProvider
    {
        public string GetUrl(UmbracoContext umbracoContext, int id, Uri current, UrlProviderMode mode)
        {
            var node = umbracoContext.ContentCache.GetById(id);
            return node.HasValue("umbracoExternalUrl")
                ? node.GetPropertyValue<string>("umbracoExternalUrl")
                : "";
        }

        public IEnumerable<string> GetOtherUrls(UmbracoContext umbracoContext, int id, Uri current)
        {
            return Enumerable.Empty<string>();
        }
    }
}

When selecting nodes in the backoffice.

Also, when i debugged, i noticed the page-model missed the "umbracoExternalUrl" field. Weird.

Someone have any idea of what is going on here?

I'm re-writing a small app with Phalcon in which I collect information about the user. Essentially, I grab firstname, lastname, email, whether or not the person is married, some numbers pertaining to that person, etc across multiple pages. When the user "finally" submits their information (after being asked to review it), I write some information to the DB and perform a number of calculations to generate a report, which gets emailed out.

Prior to the rewrite information was stored in session directly, ie

 "$firstname = $this->session.get('firstname', '');". 

I'm uncomfortable with this approach, as sessions are being used essentially as user objects. What I would like to do is generate a session id, and write that information to a database each time, and then retrieve it accordingly. However, we don't get that much information from the user, and we've noticed that people tend to start the report process and then bail out or go elsewhere. In this case, I don't know whether or not it makes sense to write to the DB each time for the sake of collecting information and flushing it at the end.

I guess what my question boils down to is what would be the ideal approach, seeing that I don't think I need to hit the DB that much. The practice of storing user information in the session could continue, or I could generate User objects and store them in the session or a cache respectively. Any thoughts on this would be much appreciated.

From a C# MVC controller action, is it possible to execute a gulp task and if so how would I go about doing this?

In my C# app, I'm trying to check if a given string (submitted in a form) is valid sass. There are a couple of C# CSS parsers but I can't find one that can handle sass (*.scss).

In my projects I use a gulp task that compiles sass and reports any errors so I was wondering if there was a way I could utilize this to do the validation in my C# app i.e. add the text input from my C# app to a .scss file, get the gulp task to try and compile it, if it passes without errors then I know the sass is valid.

Maybe I'm barking up the wrong tree here but any help would be much appreciated.

I'm having a strange issue with asp.net enabled state of radiobutton.

Client side code : http://jsfiddle.net/Yu87V/

And server side code :

Private Sub radYes_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radYes.CheckedChanged
    radDisabledYes.Enabled = radYes.Checked
    radDisabledNo.Enabled = radYes.Checked
End Sub

Private Sub radNo_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radNo.CheckedChanged
    radDisabledYes.Enabled = radYes.Checked
    radDisabledNo.Enabled = radYes.Checked
End Sub

On server side, I disable radio buttons on first load. I have the same conditions in javascript. So on client side, if user click Yes, I enable some controls. I do the same on server side. It works great with all type of controls except Radio Button.

Let say that on load, I disable radio buttons. On client side, base on user input, I enable them (in javascript). User checked a radio button and submit page. On server side, the radio button is disabled and unchecked. I have code that check the conditions and enable it. But the radio button is still not checked. I understand why, the server ignore the checked state because at first, it think it is disabled. Is there a way to make this work? I know the server is receiving the checked state because when I check Request.Form, I see radDisable=Yes.

Thanks for your help.

I had a Repeater with ViewState disabled and several input controls with ViewState enabled. After I would postback and rebind the data based off of various selections the INPUT controls didn't update. They kept the same state they had before the postback.

To elaborate if my filter was X and I had two inputs, the first one in state X1 and the second one in state X2. If I switched my filter to Y the inputs would be still in state X1 and X2 respectively.

Turning ViewState on fixed this. My question is why? I excluded most of the code because it was boiler plate. You can bind a list of integers to the Repeater and then if the integer was odd or even and set the Checkbox to that value it would function as my boiler plate code did/does.

Below is pseudocode.

<asp:repeater EnableViewState="false">
   <HeaderTemplate></HeaderTemplate>
   <ItemTemplate>
       <asp:checkbox runat="server" id="foo" EnableViewState="True">
   </ItemTemplate>
</asp:repeater>

We have an application designed 3 years back in ASP.Net & SQL Server 2008.

We designed our own login DB design and forms authentication for the application with the help of ApplicationUser, Role, Then other transaction tables using UserId for getting the corresponding user records, history records.

So far no issues with new user registration and bringing and managing existing user records.

Now our client wants to integrate, Google Account Login for the new customer and even the existing customer can sign in with the Google account.

We are wondering how it is possible. If you use Google Account to login, how we manage UserId mapping and other tables.

Is it possible to integrate the Google Account Login with the existing Application has designed with its own login implementation?

If yes, what are the things to be followed/considered for implementing this?

Making a GET request to a private (no public documentation) API returns data in JSON format.

The value im interested in is the date. It returns the date in ASP.NET JSON Date format. Here's what it looks like:

AanmeldDatum: "/Date(1406675114000+0200)/"

There's another variable called AangebodenSindsTekst which means OfferedSinceText and it's value is "8 augustus 2014". So the unknown Date format should get parsed into that specific value.

I've tried this:

require 'time'

foo = Time.strptime('1406675114000+0200', '%N') # => 2014-08-12 13:38:46 +0200
foo = Time.strptime('1406675114000+0200', '%N%z') # => 2014-08-12 14:38:58 +0200

But it simply returns the current time.

I know 100% sure that /Date(1406675114000+0200)/ when parsed, should return the date 2014-07-30.

The question is how do I make sure it does?

In the following code, the Id of the selected Country is correctly passed back to the controller when the form is submitted. However, I'd also like to pass along the Name of the Country. How can I send the Name along with the Id back to the Controller?

Model

public class MyModel
{
    public Country Country { get; set; }
    public List<Country> CountryList { get; set; }
}

public class Country
{
    public int? ID { get; set; }
    public string Name { get; set; }    
}

View

@using (Html.BeginForm())
{
   <div>
        @Html.DropDownListFor(m => m.Country.ID,
        new SelectList(Model.CountryList, "ID", "Name"))
   </div>

}

Controller

MyModel model = new MyModel();

public ActionResult Index()
{
    using (var service = new Service())
    {
        model.CountryList = service.GetCountries();

        return View(model);
    }
}

public ActionResult Index(MyModel tmpModel)
{
   return RedirectToAction("Index");
}

I have a javascript calendar and I am trying to insert custom events on this from a json object. The code for the calendar and the default events is:

 /* initialize the calendar
             -----------------------------------------------------------------*/
            //Date for the calendar events (dummy data)
            var date = new Date();
            var d = date.getDate(),
                    m = date.getMonth(),
                    y = date.getFullYear();
            $('#calendar').fullCalendar({
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                },
                buttonText: {//This is to add icons to the visible buttons
                    prev: "<span class='fa fa-caret-left'></span>",
                    next: "<span class='fa fa-caret-right'></span>",
                    today: 'today',
                    month: 'month',
                    week: 'week',
                    day: 'day'
                },
                //Random default events
                events: [
                    {
                        title: 'All Day Event',
                        start: new Date(y, m, 1),
                        backgroundColor: "#f56954", //red 
                        borderColor: "#f56954" //red
                    },
                    {
                        title: 'Long Event',
                        start: new Date(y, m, d - 5),
                        end: new Date(y, m, d - 2),
                        backgroundColor: "#f39c12", //yellow
                        borderColor: "#f39c12" //yellow
                    },
                    {
                        title: 'Meeting',
                        start: new Date(y, m, d, 10, 30),
                        allDay: false,
                        backgroundColor: "#0073b7", //Blue
                        borderColor: "#0073b7" //Blue
                    },
                    {
                        title: 'Lunch',
                        start: new Date(y, m, d, 12, 0),
                        end: new Date(y, m, d, 14, 0),
                        allDay: false,
                        backgroundColor: "#00c0ef", //Info (aqua)
                        borderColor: "#00c0ef" //Info (aqua)
                    },
                    {
                        title: 'Birthday Party',
                        start: new Date(y, m, d + 1, 19, 0),
                        end: new Date(y, m, d + 1, 22, 30),
                        allDay: false,
                        backgroundColor: "#00a65a", //Success (green)
                        borderColor: "#00a65a" //Success (green)
                    },
                    {
                        title: 'Click for Google',
                        start: new Date(y, m, 28),
                        end: new Date(y, m, 29),
                        url: 'http://google.com/',
                        backgroundColor: "#3c8dbc", //Primary (light-blue)
                        borderColor: "#3c8dbc" //Primary (light-blue)
                    }
                ],
                editable: true,
                droppable: true, // this allows things to be dropped onto the calendar !!!
                drop: function(date, allDay) { // this function is called when something is dropped

                    // retrieve the dropped element's stored Event Object
                    var originalEventObject = $(this).data('eventObject');

                    // we need to copy it, so that multiple events don't have a reference to the same object
                    var copiedEventObject = $.extend({}, originalEventObject);

                    // assign it the date that was reported
                    copiedEventObject.start = date;
                    copiedEventObject.allDay = allDay;
                    copiedEventObject.backgroundColor = $(this).css("background-color");
                    copiedEventObject.borderColor = $(this).css("border-color");

                    // render the event on the calendar
                    // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
                    $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);

                    // is the "remove after drop" checkbox checked?
                    if ($('#drop-remove').is(':checked')) {
                        // if so, remove the element from the "Draggable Events" list
                        $(this).remove();
                    }

                }
            });

            /* ADDING EVENTS */
            var currColor = "#f56954"; //Red by default
            //Color chooser button
            var colorChooser = $("#color-chooser-btn");
            $("#color-chooser > li > a").click(function(e) {
                e.preventDefault();
                //Save color
                currColor = $(this).css("color");
                //Add color effect to button
                colorChooser
                        .css({"background-color": currColor, "border-color": currColor})
                        .html($(this).text()+' <span class="caret"></span>');
            });
            $("#add-new-event").click(function(e) {
                e.preventDefault();
                //Get value and make sure it is not null
                var val = $("#new-event").val();
                if (val.length == 0) {
                    return;
                }

                //Create event
                var event = $("<div />");
                event.css({"background-color": currColor, "border-color": currColor, "color": "#fff"}).addClass("external-event");
                event.html(val);
                $('#external-events').prepend(event);

                //Add draggable funtionality
                ini_events(event);

                //Remove event from text input
                $("#new-event").val("");
            });

In the code below I substitute the dummy events with my json object and I am trying with a for loop to create custom events. The object comes normally but the events are not represented on the calendar.

  /* initialize the calendar
            -----------------------------------------------------------------*/


    $.ajax({
        type: "POST",
        url: "../services/myservice.asmx/mylist",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) {






    //Date for the calendar events (dummy data)


    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        buttonText: {//This is to add icons to the visible buttons
            prev: "<span class='fa fa-caret-left'></span>",
            next: "<span class='fa fa-caret-right'></span>",
            today: 'today',
            month: 'month',
            week: 'week',
            day: 'day'
        },
        //There i substitute the dummy events with the real that comes from  json
        events: [function () {

            for (i = 0; i < data.d.length; i++) {


                {
                    title: (data.d[i].thetitle);
                    start: new Date(data.d[i].y, data.d[i].m, data.d[i].d, 12, 0);
                    end: new Date(data.d[i].y, data.d[i].m, data.d[i].d, 14, 0);
                    allDay: false;
                    backgroundColor: "#00c0ef"; //Info (aqua)
                    borderColor: "#00c0ef"; //Info (aqua)
                }

            }
        }],

        editable: true,
        droppable: true, // this allows things to be dropped onto the calendar !!!
        drop: function (date, allDay) { // this function is called when something is dropped

            // retrieve the dropped element's stored Event Object
            var originalEventObject = $(this).data('eventObject');

            // we need to copy it, so that multiple events don't have a reference to the same object
            var copiedEventObject = $.extend({}, originalEventObject);

            // assign it the date that was reported
            copiedEventObject.start = date;
            copiedEventObject.allDay = allDay;
            copiedEventObject.backgroundColor = $(this).css("background-color");
            copiedEventObject.borderColor = $(this).css("border-color");

            $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);

            // is the "remove after drop" checkbox checked?
            if ($('#drop-remove').is(':checked')) {
                // if so, remove the element from the "Draggable Events" list
                $(this).remove();
            }

        }
    });

    /* ADDING EVENTS */
    var currColor = "#f56954"; //Red by default
    //Color chooser button
    var colorChooser = $("#color-chooser-btn");
    $("#color-chooser > li > a").click(function (e) {
        e.preventDefault();
        //Save color
        currColor = $(this).css("color");
        //Add color effect to button
        colorChooser
                .css({ "background-color": currColor, "border-color": currColor })
                .html($(this).text() + ' <span class="caret"></span>');
    });
    $("#add-new-event").click(function (e) {
        e.preventDefault();
        //Get value and make sure it is not null
        var val = $("#new-event").val();
        if (val.length == 0) {
            return;
        }

        //Create event
        var event = $("<div />");
        event.css({ "background-color": currColor, "border-color": currColor, "color": "#fff" }).addClass("external-event");
        event.html(val);
        $('#external-events').prepend(event);

        //Add draggable funtionality
        ini_events(event);

        //Remove event from text input
        $("#new-event").val("");
    });
   }
    });

I want to have gridview with freezed header . so i tried this link and this

But in all case i was able to do it. But there was problem with grid header width and columns width not being set equally. So it doesn't look good but scroll and freeze does work properly.If i dont use freeze logic then header width appears proper.

When i observed the code and comapred with mine i found that they used to set columns in the design it self where as i dont specify columns in design and I set the sql datsource from code behind and column are set as a part of sql data source.So in design i have

 <form id="form1" runat="server">
  <div>

  </div>

   <asp:GridView ID="GridView1" runat="server" Font-Size=12px CellPadding="4" 
    ForeColor="#333333" GridLines="Vertical">

   <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
    <EditRowStyle BackColor="#999999" />
    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
   </asp:GridView>

</form>

here is a screenshot which shows the problem(You can observe the change in header width and columns)

enter image description here But the example given in those links have tags and column names specified. So is this the problem?

How can i solve my problem? How can i set header width to same as column width.

edit:

Below is the rendered html of the page (but this html shows shows some what different than what asp page shows in browser. 1st row shown like shifted in html,but proper in asp. But header issue still exists in both)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<script src="./Scrollable Gridview with Fixed Header_files/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="./Scrollable Gridview with Fixed Header_files/ScrollableGridPlugin.js" type="text/javascript"></script>
<title>
Scrollable Gridview with Fixed Header
</title>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$('#GridView1').Scrollable();
}
)
</script>
</head>
<body>
    <form name="form1" method="post" action="./Scrollable Gridview with Fixed Header_files/Scrollable Gridview with Fixed Header.htm" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/">
</div>

<div>

</div>


    <div>

<div></div><div><table cellspacing="0" cellpadding="4" rules="cols" border="1" style="color: rgb(51, 51, 51); font-size: 12px; width: 900px; border-collapse: collapse;"><tbody><tr style="color:White;background-color:#5D7B9D;font-weight:bold;">
        <th scope="col" style="width: 105px;">name</th><th scope="col" style="width: 241px;">Status</th><th scope="col" style="width: 59px;">Error</th><th scope="col" style="width: 96px;">No.</th><th scope="col" style="width: 37px;">date</th><th scope="col" style="width: 100px;">date1</th><th scope="col" style="width: 59px;">Received</th><th scope="col" style="width: 51px;">time1</th><th scope="col" style="width: 100px;">time2</th><th scope="col" style="width: 22px;">AY</th><th scope="col" style="width: 26px;">we</th><th scope="col" style="width: 84px;">Setft</th>
    </tr></tbody></table></div><div style="overflow: auto; height: 200px; width: 917px;"><table cellspacing="0" cellpadding="4" rules="cols" border="1" id="GridView1" style="color:#333333;font-size:12px;width:900px;border-collapse:collapse;">
    <tbody><tr style="color:#333333;background-color:#F7F6F3;">
        <td style="width: 105px;">Sews</td><td style="width: 241px;">fggghtg</td><td style="width: 59px;">thtthgtrtht</td><td style="width: 96px;">&nbsp;</td><td style="width: 37px;">&nbsp;</td><td style="width: 100px;">&nbsp;</td><td style="width: 59px;">17:52:53</td><td style="width: 51px;">&nbsp;</td><td style="width: 100px;">&nbsp;</td><td style="width: 22px;">14-15</td><td style="width: 26px;">1</td><td style="width: 84px;">sdgg</td>
    </tr><tr style="color:#284775;background-color:White;">
        <td>Ses</td><td>dffggg</td><td>Invalid </td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>18:00:31</td><td>&nbsp;</td><td>&nbsp;</td><td>14-15</td><td>1</td>
        <td>DtyuFGtyuty</td>
    </tr><tr style="color:#333333;background-color:#F7F6F3;">
        <td>Ses</td><td>qwerty</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>18:03:42</td><td>&nbsp;</td><td>&nbsp;</td><td>14-15</td><td>1</td>
        <td>yuutyutu</td>
    </tr><tr style="color:#284775;background-color:White;">
        <td>rttty N</td><td>dffggg</td><td>Invalid </td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>20:31:14</td><td>&nbsp;</td><td>&nbsp;</td><td>14-15</td><td>1</td>
        <td>tyuutu</td>
    </tr><tr style="color:#333333;background-color:#F7F6F3;">
        <td>tyu tyu tyu</td><td>qwerty</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>17:37:02</td><td>&nbsp;</td><td>&nbsp;</td><td>14-15</td><td>2</td>
        <td>tyutu</td>
    </tr><tr style="color:#284775;background-color:White;">
        <td>tyu tyu tyu</td><td>rerty tht.</td><td>Invalid</td>
        <td>ytutyutu</td><td>13-08-2014</td><td>13-08-2014</td><td>11:43:23</td><td>10:37:26</td><td>10:37:26</td><td>14-15</td><td>2</td>
        <td>tyuutyty</td>
    </tr><tr style="color:#333333;background-color:#F7F6F3;">
        <td>Testing</td><td>qwerty</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>11:45:34</td><td>&nbsp;</td><td>&nbsp;</td><td>14-15</td><td>1</td>
        <td>tyutyu</td>
    </tr><tr style="color:#284775;background-color:White;">
        <td>Testing</td><td>qwerty</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>11:48:22</td><td>&nbsp;</td><td>&nbsp;</td><td>14-15</td><td>1</td>
        <td>tyuutut</td>
    </tr>
</tbody></table></div></div>

</form>


</body></html>

I have a webservice. I need to call a custom WSDL with some validations on fields etc. I have gone through some article and done some steps which I'll show below.

1) C# code behind

[WebService(Namespace = "http://tempuri.org/")]
//[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[WebServiceBinding(Name = "CustomWSDL", Location = "http://localhost:62783/Service1.wsdl")]

public class Service : System.Web.Services.WebService
{
    public Service () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    [SoapDocumentMethod(Action = "urn:foo-com:service/HelloWorld", Binding = "CustomWSDL")]
    public string HelloWorld(string i) {
        return "Hello World";
    }
}

The location was set as service1.wsdl. Then i changed to just check it.

Now, My WSDL looks like this.

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
      <s:element name="HelloWorld">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="i" >
              <s:simpleType>
                <s:restriction base="s:string">
                  <s:minLength value="1"/>
                </s:restriction>
              </s:simpleType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="HelloWorldResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="HelloWorldResult">
              <s:simpleType>
                <s:restriction base="s:string">
                  <s:minLength value="1"/>
                </s:restriction>
              </s:simpleType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="HelloWorldSoapIn">
    <wsdl:part name="parameters" element="tns:HelloWorld" />
  </wsdl:message>
  <wsdl:message name="HelloWorldSoapOut">
    <wsdl:part name="parameters" element="tns:HelloWorldResponse" />
  </wsdl:message>
  <wsdl:portType name="ServiceSoap">
    <wsdl:operation name="HelloWorld">
      <wsdl:input message="tns:HelloWorldSoapIn" />
      <wsdl:output message="tns:HelloWorldSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="HelloWorld">
      <soap:operation soapAction="http://tempuri.org/HelloWorld" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="ServiceSoap12" type="tns:ServiceSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="HelloWorld">
      <soap12:operation soapAction="http://tempuri.org/HelloWorld" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <!--<wsdl:service name="Service">
    <wsdl:port name="ServiceSoap" binding="tns:ServiceSoap">
      <soap:address location="http://localhost:62783/Service.asmx" />
    </wsdl:port>
    <wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12">
      <soap12:address location="http://localhost:62783/Service.asmx" />
    </wsdl:port>
  </wsdl:service>-->
</wsdl:definitions>

According to the author the wsdl:service should be commented. So, its commented.

Since I need to use the custom WSDL, I had one problem with WsiProfiles.BasicProfile1_1. So, I had to remove that using web.config.

 <system.web>
    <webServices>
      <conformanceWarnings>
        <remove name='BasicProfile1_1'/>
      </conformanceWarnings>
    </webServices>

So, into the main part.

My Webservice compiles successfully without any errors. Now, I'm importing the webservice into the application and i'm getting my new WSDL along with the auto generated WSDL. But, it gives me an error when i try to build saying.

Element binding named CustomWSDL from namespace http://tempuri.org/ is missing.

I went through MSDN and some other articles for this error but none could fix my issue.

What is the mistake i have done when creating this WSDL??


Note: MyReference: http://craigandera.blogspot.com/2005/12/using-custom-wsdl-file-in-aspnet-web_15.html

I have done exactly the same thing which he has described in the blog.

I want to access all of controllers in my web api. Let's say I have 2 controllers and 2 classes;

Foo:

string fooId

string fooName

Bar:

string barId

string barName

Sample1Controller:

Get(int fooId)

Post([FromBody] Foo foo)

Sample2Controller:

Get(int barId)

Post([FromBody] Bar bar)

I want to list of my controllers, Foo and Bar class with properties. How can I do this ?

Update:

I want to create request and response classes for mobile apps. For example If I access these details remotely, I can create request and response classes for java or objective-c.

I'm having issues getting application insights to report data to VSO from behind our firewall. I opened the firewall rules noted in this article but it didn't make a difference. I've uninstalled and reinstalled several times. The only thing that is showing up in the Operations Logs is that it's periodically purging items in the "AppDiagnostics" queue since exceed the maximum allowed size of 15 MB (full error below).

Get-WebApplicationMonitoringStatus shows all the applications I would expect to be monitored being monitored.

The health service has removed some items from the send queue for management group "AppDiagnostics" since it exceeded the maximum allowed size of 15 megabytes.

I wasn't too sure on how to aptly title this question.

I would like to discuss the best way to POST/GET data with another website in a timely manner and using jQuery as the workhorse. Of course, I am open to suggestions with better methods and libraries albeit Javascript based or C#.

Let me try and set the scenario.

The two sites share the sub-domain 'a.company' but they are two separate IIS7 sites.

Site 1

  • a.company.com/products
  • ASP MVC 5
  • Contains a 'puesdo' cart method to collect products wanted ready to pass to site2.

Site 2

  • a.company.com/checkout
  • pre-compiled by vendor no access to CS files, but can modify aspx / masterfile documents
  • ASP Webforms
  • Has limited API that will turn a URL into a product and add to it's cart.
  • Example a.company.com/checkout/product/qty

Currently, when button 'proceed to checkout' is clicked on site 1, a jQuery function loops through each cart item and produces a url similar to: a.company.com/checkout/product/qty and then loads the URL into an iframe on the document. This loop has a setTimeout function also,

jQuery(function(){

  $('#proceed').on('click', function(){
       // set integer for timeout

       n = 2;

       $(cartobject).each(function(i){

              q = item.get('qty');
              p = item.get('productid');

              // delay loop
              setTimeout(function(){ 
                   ProceedItems(q,p) 
              }, 1000 * (i + 1));
              n = n + parseInt(i);
       });

       n = n * 2 + "000"; // from each function
       // delay redirect so loop can finish
       setTimeout(function(){
            RedirectCustomerToCheckout();
       }, n );


  });

  // Proceed each item to Checkout API
  function ProceedItems(quantity, productid)
  {
      $("#iframe").attr("src","http://a.company.com/checkout/" + productid + "/" + quantity);
  }

  // when loop as finished :: take customer to checkout process.
  function RedirectCustomerToCheckout()
  {
       window.location.href = "http://a.company.com/checkout";
  } 

});

This method is work, and i appreciate, the whole 'if it ain't broke' - but my anxiety is on edge the whole time as I think there must be a better way. perhaps adding code that checks that the iframe has completed it's loading / postback?

Main concerns are: - iframe not loading (and not generating any feedback) - page redirecting user without finishing loop (because of slow connection)?

Would using an Ajax POST/GET function with a reply success/failure/complete check be anymore secure in terms ensuring load completes.

Would really enjoy some suggestions.

Remote Address:10.0.0.100:800
Request URL:http://a.company.com/checkout/46026/1
Request Method:GET
Status Code:302 Found

GET /checkout/46026/1 HTTP/1.1
Host: a.company.com
Connection: keep-alive
Accept: */*
Origin: http://a.company.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36
Referer: http://a.company.com
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

Basically, is there any performance or rendering advantage to using one over the other?

Edit for clarification: Both can be assigned a CommandName and ComandArgument, but is there a difference in postback types?

I am trying to roll my own DBResourceProviderFactory based on this MSDN article.

I downloaded the code and opened the solution. For a start I do not want a seperate solution. The resource provider should be in my web application. So I copied all the code files (DBResourceProviderFactory.cs DBResourceProvider.cs StringResourcesDALC.cs ...) to my project and corrected the namespace, fixed the local resources and edited the connectionstring in the DALC accordingly.

In the web.config I addes this gloablization configuration:

<system.web>
    <!--If MyApllicationNamespace is ommited, exception is thrown at runtime.-->
    <globalization culture="auto" uiCulture="auto" resourceProviderFactoryType="MyApplicationNamespace.DBResourceProviderFactory" />
</system.web>

In the default.aspx I added this label:

<asp:Label ID="lblHello" runat="server" Text="not translated" meta:resourceKey="lblHello"></asp:Label>

The database table contains 3 rows of data for this resource.

Upon building the application and running it in the browser, the label keeps its initial text "not translated" and all breakpoints, which I set in the DBResourceProdivder classes are never hit, hence the code is never called.

My question is: Why is it never called?

Additional Information: There are 2 labels present, which have the corresponding resourceKeys in the database

<asp:Label ID="lblHello" runat="server"  Text="HelloDefault" meta:resourcekey="lblHello" />
<asp:Label ID="lblGoodbye" runat="server"  Text="GoodByeDefault" meta:resourcekey="lblGoodbye" />

ResourceType | CultureCode | ResourceKey     | ResourceValue 
---------------------------------------------------------------
Default.aspx | de-DE       |lblHello.Text   | Hallo (de-DE) 
Default.aspx | en-US       |lblHello.Text   | Hello (en-US) 
Default.aspx | fr-FR       |lblHello.Text   | Bonjour (fr-FR) 
Default.aspx | en          |lblHello.Text   | Hello (en) 
Default.aspx | de-DE       |lblGoodbye.Text | Tschüss (de-DE) 
Default.aspx | en-US       |lblGoodbye.Text | good bye(en-US) 

For some reason (I don't know why) lblHello gets localized correctly, while lblGoodbye does not.

I could also write <asp:label id="lblhello" runat="server" text="<%$ resources: default.aspx, lblhello.text %>" />. This does work too.

In the GetObject method, there is a line for the debugger:

Debug.WriteLine(String.Format(CultureInfo.InvariantCulture, "DBResourceProvider.GetObject({0}, {1}) - type:{2}", resourceKey, culture, this.m_classKey));

If Default.aspx is called by the client this line appears in the output window:

DBResourceProvider.GetObject(lblhello.Text, ) - type:Default.aspx

But there is no call to the DBResourceProvider for lblGoodbye, which is totally weird. As if the new label was not registered, or the meta tag is not been read.