Good Morning

I have several data tables / Entities (APRICOT BANANA, LEMON) in the same model I created and is displayed in a single view

What I want to do:

It's edit and update a given line from a single table of the three tables displayed on what I click on "Edit"

Here is my model:

    public class FruitsViewModel
    {
        public List<Abricot> Abricots { get; set; }
        public List<Banane> Bananes { get; set; }
        public List<Citron> LEMON { get; set; }
    }

Voila mon controleur:

   public class SaisieReferentielController : Controller
    {
public ActionResult Index()
{
    var vm = new FruitsViewModel();
    vm.Abricots = // Récupère les abricots depuis la base de données
    vm.Bananes = // Récupère les bananes depuis la base de données
    vm.Citrons = // Récupère les citrons depuis la base de données

    return View(vm);
}
public ActionResult Edit()
{
    C'est modifier et mettre a jour d'une ligne de donnée d'une seule table des trois tables affichée sur laquelle j'ai clique sur "Modifier" 

    return View();
}
}

Thank's

I'm trying to load additional WebAPI controllers from external assemblies using MEF. In debug mode I can see that parts loaded fine under composition container. Unfortunately when I'm requesting methods from external controller I'm receiving error message:

Message: "No HTTP resource was found that matches the request URI 'localhost:56523/api/Test'." MessageDetail: "No type was found that matches the controller named 'Test'."

I've pretty much followed this article http://kennytordeur.blogspot.com/2012/08/mef-in-aspnet-mvc-4-and-webapi.html and this question: How to integrate MEF with ASP.NET MVC 4 and ASP.NET Web API

My code:

 public static class MefConfig
    {
        public static void RegisterMef()
        {
            var container = ConfigureContainer();

            ControllerBuilder.Current.SetControllerFactory(new MefControllerFactory(container));

            var mefResolver = new MefDependencyResolver(container);
            var dependencyResolver = System.Web.Http.GlobalConfiguration.Configuration.DependencyResolver;
            DependencyResolver.SetResolver(mefResolver);
            System.Web.Http.GlobalConfiguration.Configuration.DependencyResolver = mefResolver;
        }

        private static CompositionContainer ConfigureContainer()
        {
            //An aggregate catalog that combines multiple catalogs
            var catalog = new AggregateCatalog();
            catalog.Catalogs.Add(new DirectoryCatalog(ConfigurationValues.PLUGIN_DIR_PATH));
            catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
            var container = new CompositionContainer(catalog);

            return container;
        }
    }

    // WebAPI implementation:

    public class MefDependencyResolver : System.Web.Http.Dependencies.IDependencyResolver, System.Web.Mvc.IDependencyResolver
    {
        private readonly CompositionContainer _container;

        public MefDependencyResolver(CompositionContainer container)
        {
            _container = container;
        }

        public IDependencyScope BeginScope()
        {
            return this;
        }

        public object GetService(Type serviceType)
        {
            var export = _container.GetExports(serviceType, null, null).SingleOrDefault();
            return null != export ? export.Value : null;

        }

        public IEnumerable<object> GetServices(Type serviceType)
        {
            var exports = _container.GetExports(serviceType, null, null);
            var createdObjects = new List<object>();

            if (exports.Any())
            {
                foreach (var export in exports)
                {
                    createdObjects.Add(export.Value);
                }
            }

            return createdObjects;
        }

        public void Dispose()
        {
            ;
        }
    }
    // MVC implementation:

    public class MefControllerFactory : DefaultControllerFactory
    {
        private readonly CompositionContainer _compositionContainer;

        public MefControllerFactory(CompositionContainer compositionContainer)
        {
            _compositionContainer = compositionContainer;
        }

        protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)
        {
            var export = _compositionContainer.GetExports(controllerType, null, null).SingleOrDefault();

            IController result;

            if (null != export)
            {
                result = export.Value as IController;
            }
            else
            {
                result = base.GetControllerInstance(requestContext, controllerType);
                // Resolve the needed import for the controller:
                _compositionContainer.ComposeParts(result);
            }

            return result;
        }
    }

Controller in external dll:

 [Export(typeof(IHttpController))]
        [PartCreationPolicy(CreationPolicy.NonShared)]
        public class TestController : ApiController
        {
            [HttpGet]
            public String Get()
            {
                return "Test plugin one data!";
            }
        }



protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
           MefConfig.RegisterMef();

            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

        }

Am I missing anything?

When using MVC if I want to run a test on the "People" function in the home controller I can use a breakpoint at the People function and run the application in debug mode and use the URL in a browser:

http:/LH_P/Home/People

this stops at the breakpoint. Simple Q I hope but cant seem to get it for ASP.NET applicaion.

So I want to enter a URL that will hit the breakpoint at the TEST() function in the Default.aspx.cs page.

Tried something like: http://LH:PortNumbner/Default.aspx/Test

I have a similar situation as this guy. I also wish to put a @model IEnumberable<> inside the parent which is a normal @model. I did the whole thing with the viewmodel combining the two. But now I dont know how to proceed when I wish to implement my webgrid. How should I bind the model to the webgrid, and should I use @foreach since I technically dont have an IEnumerable model but I do have a IEnumberable property of that model?

@model MyViewModel

@{
var myWebGrid = new WebGrid(Model.theIEnumarablePropertyOfMyViewModel);
}

@foreach (var item in Model.theIEnumarablePropertyOfMyViewModel){
@myWebGrid.GetHtml()
}

i have my jquery like,

$(document).ready(function () {
    $('#NotAllotedStudentsGrid').jtable({
        title: 'Allot to Students below',
        paging: true,
        pageSize: 5,
        sorting: true,
        defaultSorting: 'Name ASC',
        selecting: true, //Enable selecting
        multiselect: true, //Allow multiple selecting
        selectingCheckboxes: true, //Show checkbo.xes on first column
        actions: {
            listAction: '@Url.Action("NotAllotedStudentsList")',
            //deleteAction: '@Url.Action("DeleteStudent")',
            //updateAction: '@Url.Action("UpdateStudent")',
            //createAction: '@Url.Action("CreateStudent")'
        },
        fields: {
            UserNo: {
                key: true,
                create: false,
                edit: false,
                list: false
            },
            Name: {
                title: 'Name',
                width: '15%'
            },
            Batch: {
                title: 'Batch',
            },
            EmailAddress: {
                title: 'Email address',
            },
            ContactNo: {
                title: 'Contact No',
                type: 'textarea',
            }
        }
    });

    //Load student list from server
    $('#NotAllotedStudentsGrid').jtable('load');

    //Assign selected students
    $('#SearchFor').button().click(function () {
        var SearchForValue = $("#NotAllotedStudentsList").val();
        var StudentInputTypeValue = $("#InputType").val();
        var options = {};
            options.type = "POST";
            options.url = "/Dashboard/NotAllotedStudentsList/";
            options.data = JSON.stringify({ model: { SearchFor: SearchForValue, StudentInputType: StudentInputTypeValue } });
            options.dataType = "json";
            options.contentType = "application/json";
            $.ajax(options);
    $('#NotAllotedStudentsGrid').jtable('load');//This shows old list,how to rewrite this?
    });

where,initally it displays NotAllotedStudentsGrid list, i have limited the NotAllotedStudentsGrid list using SearchForValue. But, its displays the old list. kindly tell me how to load the new list.

i have my controller like,

 public ActionResult NotAllotedStudentsList(AllotQuestionSet model,int jtStartIndex = 0, int jtPageSize = 0, string jtSorting = null)
    {
        List<TutorStudentsGridModel> tutorStudentsGridModelList = new List<TutorStudentsGridModel>();
        User userDetails = _sessionHelper.Get<User>(KrackemSessionConstants.UserDetails);
        StudentResponse studentListResponse = new StudentResponse();
        int questionSetNo = Int32.Parse(_sessionHelper.Get<string>(KrackemSessionConstants.QuestionSetNo));

        if (model.SearchFor != null && model.StudentInputType == StudentInputType.ContactNo)
        {
            StudentRequest studentRequest = new StudentRequest
            {
                TutorUserNo = userDetails.UserNo,
                QuestionSetNo = questionSetNo,
                InputString = model.SearchFor
            };

             studentListResponse = _questionSetServiceHelper.GetNotAllottedStudentsByContactNo(studentRequest);

        }
               foreach (StudentContract studentDetails in studentListResponse.StudentList)
            {
                TutorStudentsGridModel tutorStudentsGridModel = MappingEngineFactory.GetMappingEngine().Map<StudentContract, TutorStudentsGridModel>(
                    studentDetails);
                tutorStudentsGridModel.Id = studentDetails.UserNo;

                tutorStudentsGridModelList.Add(tutorStudentsGridModel);
            }

        if (jtSorting != null)
            tutorStudentsGridModelList = ControllerHelper.SortList(jtSorting, tutorStudentsGridModelList);

        tutorStudentsGridModelList = jtPageSize > 0 ? tutorStudentsGridModelList.Skip(jtStartIndex).Take(jtPageSize).ToList() : tutorStudentsGridModelList.ToList();

        return Json(new { Result = "OK", Records = tutorStudentsGridModelList, TotalRecordCount = studentListResponse.StudentList.Count() });
    }

I have a template service that uses RazorEngine to generate HTML for email sending.

I want to make it easy to add a new template to the project, meaning that I don't want to specify the file build action.

Is there a way where I still have the .cshtml file in my project with intellisense and etc. but it automatically will set their build action to Embedded Resource?

Here is a example of my project structure

Example of solution

I am using this action-link to send a route value id to controller but my id value like this config.xml and here is my action-link

 @Html.ActionLink("Destroy", "DeleteFile", "Files", new { id = "config.xml"})

The question is when I want to click this link browser understand this as a url that ends with config.xml

like this

http://localhost:12380/Files/DeleteFile/config.xml

and doesn't go to the controller it returns 404 - not found. How to prevent this from happening and make this config.xml as a parameter not as a file?

here is my route also

routes.MapRoute(
              name: "delete files",
              url: "Files/DeleteFile/{id}",
              defaults: new
              {
                  controller = "Files",
                  action = "DeleteFile",
                  id= UrlParameter.Optional
              }
            );

also i tried instead id ,filename but nothing changed

and here is my controller

[HttpGet]
        public ActionResult DeleteFile(string id)
        {
          return view("DeleteFile");
         }

I'm currently migrating some components of a WebForms / MVP application into MVC. So far, everything is working except for authorization. No matter what, when I navigate to the MVC version of the Login page, I get redirected to the aspx page that is set in the Web.config:

    <authentication mode="Forms">
      <forms name=".MyWebSite" enableCrossAppRedirects="true" loginUrl="Login.aspx" timeout="60" path="/" defaultUrl="~/Pages/Landing.aspx"></forms>
    </authentication>

I've tried using AllowAnonymous but it appears that the webforms config are taking precedence. Here's my Login controller:

[RouteArea("User", AreaPrefix = "")]
public class AuthenticationController : Controller {
    [Route("Login")]
    [AllowAnonymous]
    public ActionResult Login() {
        return View();
    }
}

And my Directory structure looks like this:

> Web Project
   > Areas
      > User 
          > Controllers
              > AuthController
          > Views
              > Login.cshtml

In my web.config, I see the following to allow anonymous access to the Error pages:

  <location path="Error">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>

However duplicating this for the Areas path isn't working (presumably because the cshtml files are not actually located there as aspx pages are?).

Now, if I am logged in (via the aspx version of login) and my user is authenticated, I can access the MVC implementation just fine. Routing and rendering are working wonderfully. It's just allowing unauthenticated users to access the MVC page (without redirecting to the aspx implementation) that seems to be a challenge. What am I doing wrong?

EDIT A really hacky partial solution I've found (based on Turning off ASP.Net WebForms authentication for one sub-directory) is the following:

    protected void Application_BeginRequest(object sender, EventArgs e) {
        // lots of existing web.config controls for which webforms folders can be accessed
        // read the config and skip checks for pages that authorise anon users by having
        // <allow users="?" /> as the top rule.
        // http://stackoverflow.com/questions/4616524/turning-off-asp-net-webforms-authentication-for-one-sub-directory

        // check local config
        var localAuthSection = ConfigurationManager.GetSection("system.web/authorization") as AuthorizationSection;

        // this assumes that the first rule will be <allow users="?" />
        var localRule = localAuthSection.Rules[0];
        if (localRule.Action == AuthorizationRuleAction.Allow && localRule.Users.Contains("?")) {
            // then skip the rest
            return;
        }

        // get the web.config and check locations
        var conf = WebConfigurationManager.OpenWebConfiguration("~");
        foreach (ConfigurationLocation loc in conf.Locations) {
            // find whether we're in a location with overridden config

            // get page name
            var currentPath = Path.GetFileName(this.Request.Path);
            if (currentPath.Equals(loc.Path, StringComparison.OrdinalIgnoreCase)) {
                // get the location's config
                var locConf = loc.OpenConfiguration();
                var authSection = locConf.GetSection("system.web/authorization") as AuthorizationSection;
                if (authSection != null) {
                    // this assumes that the first rule will be <allow users="?" />
                    var rule = authSection.Rules[0];
                    if (rule.Action == AuthorizationRuleAction.Allow && rule.Users.Contains("?")) {
                        // then skip the rest
                        return;
                    }
                }
            }
        }
    }

Which means I can specify "Login" like this:

  <location path="Login">
    <system.web>
      <authorization>
        <allow users="?" />
      </authorization>
    </system.web>
  </location>

But then all of the associated CSS/JS do not get rendered, unless I go through and add rules for those filetypes. There's got to be a more elegant fix to this.

I want to stylize kendo treeview items based on a value in the view model.

My controller:

   public ActionResult Index()
    {
        var feeders = FeedersService.GetAll();
        var result = from res in feeders select toFeedersViewModel(res);
        ViewBag.items = getItems(result, null);
        return View();
    }

    public IEnumerable<TreeViewItemModel> getItems(IEnumerable<FeedersViewModel> feeders, string parent)
    {
        var list = new List<TreeViewItemModel>();
        foreach (var item in feeders.Where(t => t.Parent == parent))
        {
            list.Add(new TreeViewItemModel()
            {
                Text = item.RootName,
                Items = getItems(feeders, item.RootName).ToList(),
                ImageUrl = item.Parent == null ? "~/Content/web/treeview/folder.png" : "~/Content/web/treeview/file.png",
                Expanded = true,
                HtmlAttributes = item.Status == 0 ? new Dictionary<string, string>() { { "'class'", "'white'" } } : new Dictionary<string, string> { { "class", "red" } }

            });
        }            
        return list;
    }

My View Looks:

@(
    Html.Kendo().TreeView()
        .Name("treeview")
        .BindTo((IEnumerable<TreeViewItemModel>)ViewBag.items)
 )

<style scoped>
.red
{
    color:red;
}

.white
{
    color:white;
}
</style>

The treeview is working as expected but the htmlattributes dictionary passed from the controller is not changing the css of the treeview items.

At the moment I have created two tables within my view, each table is different. One contains a summary of information and the other a detailed view. I have passed a variable in called 'Report Type'. If it is type 1, I would like it to display the summary table. If it is type 2, I would like it to display the detailed table. My question is, how would I go about doing this? My code is below, you can see both tables and also how the Report Type will be passed in. Thank you.

 <% Using Html.BeginForm("ReportCriteria", "Reports", Nothing, FormMethod.Post, New With {.id = "formReportCriteria"})%>

    <center>

    <%: MasterPageHelpers.ContainerStart("wid1", "Results", 16)%>

    <div>
        Date From: <%: Model.DateFrom%>
        <br />
        Date To: <%: Model.DateTo%>
        <br />
        Report Type: <%: Model.ReportType%>
    </div>
        <div>
        <table class="sorted-table">
            <thead>
                <tr>
                    <th>Client</th>
                    <th>Tickets Created</th>
                    <th>Tickets Resolved</th>
                </tr>
            </thead>
            <tbody>
               <%
                   Dim oResult As Object
                   For Each oResult In Model.ReportResults
                       Response.Write("<tr>")
                       Response.Write("<td>" & oResult.ClientName & "</td>")
                       Response.Write("<td>" & oResult.CreatedCount & "</td>")
                       Response.Write("<td>" & oResult.ResolvedCount & "</td>")
                       Response.Write("</tr>")
                   Next


                %>
            </tbody>
            </table>
        </div>
        <div>
            <table class="sorted-table">
                <thead>
                    <tr>
                        <th>Client</th>
                        <th>Classification</th>
                        <th>Tickets Created</th>
                        <th>Tickets Resolved</th>
                    </tr>
                </thead>
                <tbody>
                <% 
                    For Each oResult In Model.ReportResults
                        Response.Write("<tr")
                        Response.Write("<td>" & oResult.ClientName & "</td>")
                        Response.Write("<td>" & oResult.ClassificationDesc & "</td>")
                        Response.Write("<td>" & oResult.CreatedCount & "</td>")
                        Response.Write("<td>" & oResult.ResolvedCount & "</td>")
                    Next
                %>
                </tbody>
             </table> 
         </div>
    </center>

    <% End Using%>


    <%: MasterPageHelpers.ContainerEnd%>

This is a best practice question. I have a basic Model View Controller (MVC) system. Normally, i want to pass some data from Controller to the class responsible for graphic representation (View). Also, i have an interface that defines the communication of the two components (View-Controller) with specific methods.


I have two (as i see it) choices:

1) Pass the data the View need, through the functions of the interface.

2) Have a reference of the Controller as an attribute in the View class and acquire these data from this reference.


What is the best way to go, considering that i don't care so much about performance rather than scalability and extensibility. When a change is applied in the controller, which method would have the least impact on my system?

May you tell me how to create an unique link to user profile using ASP MVC? just like in social networks (example vk.com)

I need to add facebook and linkedin login buttons in my website, i need to know if there are any third party tools that we can use in our website to embed facebook and linkedin login buttons.

i have checkbox with value(value is from database), i want to calculate the total fee and display it at Total Amount(below the table).Total Amount will auto update when user selected or unselect it.

            <LayoutTemplate>
                 <table border="1" cellpadding="4" cellspacing="0" class="table-grid2" width="100%">
                    <tr style="background-color:#CCE1FF;">
                     <thead>
                          <td style="width:1%;" class="line_table_thL"><input type="checkbox" value="" onclick="check_chkItems_toggle(this, 'chkbox');" /></td>
                            <th class="line_table_th" style="width:1%;">No.</th>
                            <th class="line_table_th" style="width:6%;">Waybill No.</th>
                            <th class="line_table_th" style="width:4%;">Service Type</th>
                            <th class="line_table_th" style="width:5%;">Delivered/Received Date</th>
                            <th class="line_table_th" style="width:4%;">Total Fee</th>
                            <th class="line_table_th" style="width:4%;">Postal Status</th>
                            <th class="line_table_th" style="width:4%;">Register By</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr runat="server" id="itemPlaceholder">
                        </tr>
                    </tbody>
             </LayoutTemplate>
                      <ItemTemplate>
                         <td class="line_table_tdL"><input type="checkbox" name="chkbox" value="<%# Eval("postal_id") %>" /></td>
                         <td class="line_table_td"><%# Eval("RowNum") %>&nbsp;</td>
                         <td class="line_table_td"><%# Eval("WAYBILL_NO") %>&nbsp;</td>
                         <td class="line_table_td"><%# Eval("POSTAL_TYPE") %>&nbsp;</td>
                         <td class="line_table_td"><%# Eval("SR_DATE") %>&nbsp;</td>
                         <td class="line_table_td"><%# Eval("TOTAL_FEE") %>&nbsp;</td>
                         <td class="line_table_td"><%# Eval("STATUS") %>&nbsp;</td>
                         <td class="line_table_td"><%# Eval("REG_ID") %>&nbsp;</td>
                     </tr>
                      </ItemTemplate>

 <td>Total Amount : <span id="total"> </span></td>

my jquery :

 function calculate(item) {
             var total = 0;
             if (item.checked) {
                 total += parseInt(item.TOTAL_FEE);
             } else {
                 total -= parseInt(item.TOTAL_FEE);
             }
             //alert(total);
             document.getElementById('Totalcost').innerHTML = total + " /-";
         }

i want to detect Mifare Card using Card reader in asp.net C# in server client mode in detail my application hosted in server access via client computer via broswer i am trying Active X componet which is broswer dependend any idea save my work

We have created an asp.net application now the application sends email using smtp, sending email is ok but as we received it on outlook we are received it as name.lastname@company.com and not the Full Name (James Reign). Please help me, below are my code snippets.

<system.net>
<mailSettings>
  <smtp from="lastname@company.com">
    <network defaultCredentials="false" host="server" password="lalala" userName="James.Reign" />
  </smtp>
</mailSettings>

Hi there is a Telerik grid. and inside it there are two textBox Columns named sign in time and sign out. finally there is a label column too, to have the hours from the time signed in to sign out. that should be calculated and shown as other two textBox values change. What should i do ? below js function is called in onkeypress of txtsignout textbox

var grid = $find("<%= rdgDriverTimeSheets.ClientID %>");
                    if (grid) {

                            var MasterTable = grid.get_masterTableView();
                            var Rows = MasterTable.get_dataItems();
                            for (var i = 0; i < Rows.length; i++) {
                                var row = Rows[i];

                                var signIn = row.findControl("txtSignIn").get_value();
                                //var signOut = args.get_keyCharacter();
                                var signOut = row.findControl("txtSignOut").get_value();
                                // var hours = signOut - signIn;
                                //row.findControl("lblHours").set_value(hours)
                        }

this is my grid

Category column1 column2 total row1 1 2 3 row2 1 0 1 total 2 2 4

I only able to get value to calculate at column[0] but not start it from column[1]. What did I miss out in this ?

Dim totalrow = ExportDT.NewRow For Each col As Data.DataColumn In ExportDT.Columns

            For n_Loop As Integer = 1 To ExportDT.Columns.Count - 1
                 Dim colname As Integer = col.ColumnName[n_loop]

                totalrow(col.ColumnName) = Convert.ToDouble(ExportDT.Compute("SUM(" & colname & ")", "nothing"))
            Next
        Next

        ExportDT.Rows.Add(totalrow)

I am trying to post some signup form fields via CURL and PHP in .aspx site. I find the onclick event in the Register button.

<a onclick="return Page_ClientValidate('vg_registration');" id="dnn_ctr949_View_ctrl_notLoggedIn_registerCtrl_lb_register" class="button_black" href="javascript:__doPostBack('dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$lb_register','')">Register</a>

MY PHP CURL CODE TO POST FIELDS ARE AS FOLLOWS

**<?php
// Login information
$salutation = '1';
$password = '1234567';
$password_repeat = '1234567';
$fname="John";
$lname="William";
$email="william2022@gmail.com";
$street="14 decres lane";
$city="Delhi";
$country="IND";
$mphone="8012345676";
$postal="400145";
$utcoffset = '-6';
$cookiefile = 'ticket/cookies.txt';
$client = new Login($cookiefile);
// Retrieve page first to store cookies 
$page = $client -> get("http://www.websitename.com/my-account/register");
// scrape __VIEWSTATE value
preg_match('~<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="(.*?)" />~', $page, $viewstate);
preg_match('~<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.*?)" />~', $page, $eventvalidation);
$viewstate = $viewstate[1];
$eventvalidation = $eventvalidation[1];
$form_data = array(
    '__EVENTTARGET' => '',
    '__EVENTARGUMENT' => '',
    '__VIEWSTATE' => rawurlencode($viewstate),
     '__EVENTVALIDATION' => rawurlencode($eventvalidation),
    'dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$ddl_salutation' => $salutation,
    'dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$tb_firstname' => $fname,
    'dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$tb_lastname' => $lname,
    'dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$tb_email' => $email,
    'dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$tb_password' => $password,
    'dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$tb_password_repeat' => $password_repeat,
    'dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$tb_street' => $street,
    'dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$tb_postalCode' => $postal,
    'dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$tb_city' => $city,
     'dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$ddl_country' => $country,
     'dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$tb_mobile' => $mphone,
     //'dnn$ctr949$View$ctrl_notLoggedIn$registerCtrl$lb_register' => ''
);
print_r($form_data); 
// Do our actual login
$page = $client -> get("http://www.websitename.com/my-account/register", $form_data);
//echo $page;
// cURL wrapper class    
class Login {
    private $_cookiefile;
    public function __construct($cookiefile) {
        if (!is_writable($cookiefile)) {
            //throw new Exception('Cannot write cookiefile: ' . $cookiefile);
        }
        $this -> _cookiefile = $cookiefile;
    }
    public function get($url, $data = false) {
        // Setup cURL
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);

        curl_setopt($ch, CURLOPT_ENCODING,"UTF-8");
        curl_setopt($ch, CURLOPT_VERBOSE, 1);
        //curl_setopt($ch, CURLOPT_REFERER, $referer);
        curl_setopt($ch, CURLOPT_HEADER, 0);
         curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:11.0) Gecko/20100101 Firefox/11.0' );
        curl_setopt($ch, CURLOPT_COOKIEFILE, $this -> _cookiefile);
        curl_setopt($ch, CURLOPT_COOKIEJAR, $this -> _cookiefile);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_AUTOREFERER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
        curl_setopt($ch, CURLOPT_TIMEOUT,120);
        //curl_setopt($ch, CURLOPT_MAXREDIRS, 10);

        // Is there data to post
        if (!empty($data)) {
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
            //curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
            //echo http_build_query($data);


         }


    $repsonse=curl_exec($ch);

     $err = curl_errno($ch);
    $errmsg = curl_error($ch) ;
    $header = curl_getinfo($ch);

    print_r( $header);

    curl_close($ch);
        return $repsonse;

    //curl_close($ch);
    }
}
?>**

I am getting error from the remote server :-

A critical error has occurred. Please check the Event Viewer for further details . 

I have captured the _viewstate and _eventvalidation properly and pass the value into post parameters along with other parameters.
But it is not posting any fields. I am not able to make out where the problem lies actually.
Is the remote server recognizing bot?

You may also consider the part of the following output for better understanding (after posting fields the following header is printed) :

Array ( [url] => http://www.websitename.com/Default.aspx?tabid=184&
error=An%20unexpected%20error%20has%20occurred&content=0 [content_type] => text/html;
charset=utf-8 [http_code] => 200 [header_size] => 1477 [request_size] => 1100 
[filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 1 [total_time] => 
1.072382 [namelookup_time] => 4.0E-5 [connect_time] => 0.081338 [pretransfer_time] => 
0.081449 [size_upload] => 0 [size_download] => 65573 [speed_download] => 61147 
[speed_upload] => 0 [download_content_length] => 65573 [upload_content_length] => -1 
[starttransfer_time] => 0.260364 [redirect_time] => 0.563111 [certinfo] => Array ( ) 
[redirect_url] => )

Would be a gr8 help if someone can show me a silverline in the problem. Thanks Krish

I have written one code Using property in text box i am setting some values like this

public string Color

{ 

get{}; 

set
  { 

     SetColor(value);

  } 

} 

private void SetColor(string level)
{

    switch(level.ToLower())
    {

     case "high":

     textbox1.BackColor = System.Drawing.Color.Red;

     break;

     case "medium":

     textbox1.BackColor = System.Drawing.Color.Green;

     break;

     case "low":

     textbox1.BackColor = System.Drawing.Color.Yellow;

     break;

   }

}

But my main aim is i need to set flag , if the flag is High it should show red font similarly if the flag is medium it should show yellow font in label.

public static class EnumExtensions
{
    private static void CheckIsEnum<T>(bool withFlags)
    {

            CheckIsEnum(T) (True);
    }
}



 public static bool IsFlagSet<T>(this T value, T flag)
{



}

Will I need to Use a pipe symbol while setting flag variable? I was surfing this on net, but I get answers which is not I am expecting. One one flag Boolean true or false. IKf the flag is true the color font should be enable according. Also please help me on I need to get data from data base. will it be possible and see whether the particular value has high ,low or medium risk and display font accordingly

Could anyone advice me how to embed the above code in the flags using enum.

I want this web application. please help me how to resolve this.

I have some problems understanding mvc in php.

My folder structure looks like this:

controller
|- member.php
model
|- member.php
view
|- overview.php

My code looks like this:

controller > member.php

include '../model/member.php';

class Member{
    public function create_table_of_all_members(){
        $model = new Member();

        $members = $model->get_all_members();

        foreach ($members as $member) {
            echo $member;
        }
    }

    public function create_form(){

    }
}

model > member.php

class Member{
    public function __construct()
     {
        // DB-Connection initialization
     }

    function getAllMembers(){
        $sql = "";
        return $result;
    }
}

view > overview.php

include '../controller/member.php';

$controller = new Member();
$controller->create_table_of_all_members();

Am I on the right way? In the view folder I would put e.g overview (all pages with a table), form (all pages with a form)..