I posted a question a few days ago about a Win32 Exception error about the parameter was incorrect when deploying to godaddy, that link is here Well after some more digging around, I thought I had figured out the issue because what I was trying to do was not only deploy the web app (which I have successfully done) but also deploy the asp.net membership database that gets created when creating a project and using the Webforms template in VS2013. So I found some tutorials on this here and here So after following and trying both, I am still getting the same error that I mentioned in my original question. I took a look at the webconfig and noticed this connectionstring

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-GSDataCollection-20150421103634.mdf;Initial Catalog=aspnet-GSDataCollection-20150421103634;Integrated Security=True" providerName="System.Data.SqlClient" />

This was created when I created the project. I commented that out because I generated scripts from SSMS with schema and data, and ran it against the shared database and then added this connectionstring

<add name="DefaultConnection" connectionString="Data Source=*****:1433;Initial Catalog=*****;Persist Security Info=True;User ID=*****;Password=*****" providerName="System.Data.SqlClient" />

this is the connectionstring that I use to connect to the database through SSMS and was provided when I opened the database in the Server Explorer of Visual Studio and got it from right clicking the database and clicking properties then copied it over from properties area. So next I went back to SSMS and queried the table to make sure that there was data in the AspNetUsers table and there was. So after a number of failed attempts at registering on the site and getting the same Win32 Exception error, I decided to go into the App_Data folder and published the database and thought maybe that was the issue and no, didn't work again.

So I thought that maybe that I may have done something wrong and wrote a test app to see if I could connect to the database and just wrote this

string cnStr = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
SqlConnection cn = new SqlConnection(cnStr);

string cmStr = "SELECT * FROM AspNetUsers";
SqlCommand cm = new SqlCommand(cmStr, cn);
cm.CommandType = CommandType.Text;

DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cm);

cn.Open();
da.Fill(ds);
cn.Close();

I set a break point at da.fill(ds); and it threw the exact same error as it did from my original project and that error is

Additional information: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)

So I am pretty lost now on what to do or try, and am still waiting on a response from GoDaddy. Has anyone had any issues on deploying a web application that uses asp.net membership database? or does anyone notice where I may have went wrong?

EDIT

Here is the entire IdentityModel with the DbContext

    using System;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using GSDataCollection.Models;

namespace GSDataCollection.Models
{
// You can add User data for the user by adding more properties to your User class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser
{
    public ClaimsIdentity GenerateUserIdentity(ApplicationUserManager manager)
    {
        // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
        var userIdentity = manager.CreateIdentity(this, DefaultAuthenticationTypes.ApplicationCookie);
        // Add custom user claims here
        return userIdentity;
    }

    public Task<ClaimsIdentity> GenerateUserIdentityAsync(ApplicationUserManager manager)
    {
        return Task.FromResult(GenerateUserIdentity(manager));
    }
}

public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
    public ApplicationDbContext()
        : base("DefaultConnection", throwIfV1Schema: false)
    {
    }

    public static ApplicationDbContext Create()
    {
        return new ApplicationDbContext();
    }
}
}

#region Helpers
namespace GSDataCollection
{
public static class IdentityHelper
{
    // Used for XSRF when linking external logins
    public const string XsrfKey = "XsrfId";

    public static void SignIn(ApplicationUserManager manager, ApplicationUser user, bool isPersistent)
    {
        IAuthenticationManager authenticationManager = HttpContext.Current.GetOwinContext().Authentication;
        authenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
        var identity = manager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie);
        authenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity);
    }

    public const string ProviderNameKey = "providerName";
    public static string GetProviderNameFromRequest(HttpRequest request)
    {
        return request.QueryString[ProviderNameKey];
    }

    public const string CodeKey = "code";
    public static string GetCodeFromRequest(HttpRequest request)
    {
        return request.QueryString[CodeKey];
    }

    public const string UserIdKey = "userId";
    public static string GetUserIdFromRequest(HttpRequest request)
    {
        return HttpUtility.UrlDecode(request.QueryString[UserIdKey]);
    }

    public static string GetResetPasswordRedirectUrl(string code, HttpRequest request)
    {
        var absoluteUri = "/Account/ResetPassword?" + CodeKey + "=" + HttpUtility.UrlEncode(code);
        return new Uri(request.Url, absoluteUri).AbsoluteUri.ToString();
    }

    public static string GetUserConfirmationRedirectUrl(string code, string userId, HttpRequest request)
    {
        var absoluteUri = "/Account/Confirm?" + CodeKey + "=" + HttpUtility.UrlEncode(code) + "&" + UserIdKey + "=" + HttpUtility.UrlEncode(userId);
        return new Uri(request.Url, absoluteUri).AbsoluteUri.ToString();
    }

    private static bool IsLocalUrl(string url)
    {
        return !string.IsNullOrEmpty(url) && ((url[0] == '/' && (url.Length == 1 || (url[1] != '/' && url[1] != '\\'))) || (url.Length > 1 && url[0] == '~' && url[1] == '/'));
    }

    public static void RedirectToReturnUrl(string returnUrl, HttpResponse response)
    {
        if (!String.IsNullOrEmpty(returnUrl) && IsLocalUrl(returnUrl))
        {
            response.Redirect(returnUrl);
        }
        else
        {
            response.Redirect("~/");
        }
    }
}
}
#endregion

It seems to work and load all the project files which are present in the original folder. Just wanted to make sure I am not missing anything!

I have 2 handlers: 'Logout' and 'KeepAlive'. These handlers located under 'Handlers/Session/' directory (from root, not the 'App_Code'). I can access 'Logout.ashx' handler successfully but I can't access 'KeepAlive.ashx' just because of an annoying error.

Error

Source codes:

Logout.ashx

<%@ WebHandler Language="C#" Class="Logout" %>
using System.Web;
using System.Web.SessionState;

public class Logout : IHttpHandler, IRequiresSessionState
{
    public bool IsReusable { get { return false; } }

    public void ProcessRequest(HttpContext context)
    {
        if(context.Session["Username"] != null) { context.Session.Abandon(); }
        context.Response.Redirect("~");
    }
}

KeepAlive.ashx

<%@ WebHandler Language="C#" Class="KeepAlive" %>
using System;
using System.Web;
using System.Web.SessionState;

namespace Web.Handlers
{
    public class KeepAlive : IHttpHandler, IRequiresSessionState
    {
        public bool IsReusable { get { return false; } }

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Write(DateTime.UtcNow);
        }
    }
}

Handlers doesn't have '.cs' files. I'm really confused, why Logout works but KeepAlive not works? I tried to re-compile entire MVC4 application (Clean>Build) but it's not a solution. Any suggestions?

@{
    if (Session["LoginType"] == null)
    {
       Response.Redirect("~/Account/Login", true);
    }

}

If the Session expires, the Session["LoginType"] becomes null. I can catch that. But the next line to redirect to the login page again, doesn't work. Yellow code line in break mode just stops on it, then moves on to next lines of code (that gives an error because the Session["LoginType"] is null.

Any ideas? Am I coding this wrong? Not really an expert at this MVC/Razor stuff.

I'm developing a simple sort of shopping cart using Session state. I got everything working, but I try to add a functionality of adding additional units of the same item. I have a Cart class that carries a list of CartItems. Each CartItem has Product and its Quantity. The view with the GET method gets a nicely updated cart and Session (aside from quantities, which I aim to fix with the POST request).

I tried the path below, but the quantity is always stuck at 0. I saw a similar post here, which likely addressess same issue.

http://stackoverflow.com/questions/23363813/why-isnt-my-viewmodel-updating

but it requires Knockout js, which I was not exposed to yet (and need to finalize my school project on short timeline). I will greatly appreciate if there are ideas around wihtout knockout. Below is a simplified code for clarity.

Controller

[HttpPost]
public ActionResult Show(CartViewModel cvm) 
{
Cart cart = (Cart)Session["Cart"];
cvm.CartItems = cart.CartItems;

StringBuilder sb = new StringBuilder();

if (TryUpdateModel(cvm))
{
    foreach (CartItem c in cvm.CartItems)
    {
        sb.Append(c.Product.Name); // works
        sb.Append(c.Quantity); // always 0 :(
    }
}

return RedirectToAction("Index", "Home");
}

View

@model Project.ViewModels.CartViewModel

@using (Html.BeginForm())
{
foreach (var item in Model.CartItems)
    {
        @item.Product.Name
        <img src="@item.Product.Image" alt="@item.Product.Name"/>

    @Html.EditorFor(i => item.Quantity)
    }
}

<input type="submit" value="Send" />

}

So first off, I'm working on this for a project at work, but none of us have any idea how to do it, so it might be kind of vague.

Here is the template of how it is going to look: Template

So View A & B are going to have 3 states in them that will change the content of the view based on which one is selected

The problem I'm having is that only 1 view ever shows up and it is a test template for now because I don't have those views built but none of the sub views of View A ever show up.

States:

$stateProvider.state("main", {
    url: "/main",
    views: {
        "viewa@": {
            abstract: true,
            template: "<div ui-view></div>",
            url: "/A"
        },
        "viewb@": {
            templateUrl: "btemps/default.html"
        }
    }
}).state("bobtheView", {
    parent: "viewa",
    //This is default for viewa
    url: "/",
    templateUrl: "atemps/bob.html",
    controller: "bobController"
}).state("billtheview", {
    parent: "viewa",
    url: "/bill",
    templateUrl: "atemps/bill.html",
    controller: "billController"
}).state("joetheview", {
    parent: "viewa",
    url: "/joe",
    templateUrl: "atemps/joe.html",
    controller: "joeController"
});
//Supposed to route to viewa showing bobtheview and viewb showing the template
$urlRouterProvider.otherwise("/main/");

So when I go to the page and go to the root it redirects to the otherwise but nothing shows up, upon just going to main, only the viewb template shows up.

Any ideas? Any way I can format it better too? Is it better to go with "viewa.bobtheview" over having the parent attribute in the mix?

I've got a project where I am using .NET MVC 4 and AngularJS. I'd like to use MVC partial views for my Angular templates, but to do this I need the URL's to these templates.

<div ng-include="'@Url.Action("Sidebar")'"></div> doesn't seem to work, it just returns an empty string. How can I get the URL returned here AND maintain strong typing/intellisense in Visual Studio.


With strong typing I get UI feedback and build errors when an incorrect view is passed in

Valid view Invalid view

I've seen suggestions online of other extension methods that just take strings as the action name, which do not provide strong typing.


On an older project I worked on, we were using T4MVC templates and I could just call a custom extension method like: @MVC.MyPartialView().ToUrl()

Which worked like this:

namespace System.Web.Mvc
{
    public static class ActionResultHelper
    {

        public static string ToUrl(this ActionResult actionResult)
        {
            var callInfo = actionResult.GetT4MVCResult();
            var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
            var url = urlHelper.AbsoluteAction(callInfo.Action, callInfo.Controller, callInfo.RouteValueDictionary);
            return url;
        }
    }
}

However I do not know how to make this work in my current project where we do not want to use T4MVC.

I have a simple site, where the user must upload a PDF to display handicaps, I can upload the pdf to the filesystem (currently it goes into ~/app_data/uploads

I want to be able to view the pdf (href link to the pdf) and all uploaded pdf's on the index page.

My Controller

  public class HandicapsController : Controller
{
    // GET: Handicaps
    public ActionResult Index()
    {
        return View();
    }


    [HttpPost]
    public ActionResult Index(HttpPostedFileBase file)
    {

        if (file.ContentLength > 0)
        {
            var fileName = Path.GetFileName(file.FileName);
            var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
            file.SaveAs(path);
        }

        return RedirectToAction("Index");
    }
}

My View

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}


<form action="" method="post" enctype="multipart/form-data">

  <label for="file">Filename:</label>
  <input type="file" name="file" id="file" />

  <input type="submit" />
</form>

I am programming my first .NET Project including Lucene for an article search. Everything works fine for me but I got a problem in boosting special documents. I receive my articlelist to index from a database where every article has a special column for priority with values from 0 to 8.

First I tried to set the boost for a whole document by:

Document doc = new Document();
doc.add(new Field(...));
doc.add(new Field(...));
doc.add(new Field(...));
...
doc.Boost = (float)column.priority;

But this didn't do what I expected.

Then I tried to set the boost for every field I use in my search like:

Document doc = new Document();
if(){
   Field field = new Field(...);
   field.boost = (float)column.priority;
   doc.add(field);
}

But this also didn't work.

I also tried to use Luke to analyse the scoring but I can't find a special boosting factor in the result explain function.

Does someone know where is the mistake or is it a general misunderstanding of boosting?

Thanks for any answer or hint....MOE

What the syntax to add the following javascript within my razor (chtml) template?

<script type="text/javascript">

 $(function(){ 
    @if(Model.IsModalShown)
    {
        $('#myModal').modal('show');
    }
 });

</script>

I'm using ASP MVC4 with razor and I'm stuck to return some infos from my view to my controller in a list with the below elements... I use the TextBox to be able to run my js function... I use the following (updatesum()) javascript to dynamically calculate in the field the sum of the archer's score in my view:

<td> 
    @Html.TextBox("suma["+@i+"]", Model[i].ArchScore1,  new{ @onchange = "updatesum()"})
    @Html.ValidationMessageFor(x => x[i].ArchScore1)
</td> 
<td>
    @Html.TextBox("sumb["+@i+"]", Model[i].ArchScore2, new { @onchange = "updatesum()" })
    @Html.ValidationMessageFor(x => x[i].ArchScore2)
</td>
<td> 
    @Html.TextBox("sumt["+@i+"]", Model[i].ArchTot`enter code here`alScore, new { @onchange = "updatesum()" })
    @Html.TextBoxFor(x=>x[i].ArchTotalScore)
    @Html.ValidationMessageFor(x => x[i].ArchTotalScore)
</td> 

<script type="text/javascript">
    function updatesum() {
        for (i = 0; i < 15; i++) {
            var sua = "suma_" + i + "_";
            var sub = "sumb_" + i + "_";
            var sut = "sumt_" + i + "_";
            suma = document.getElementById(sua).value;
            sumb = document.getElementById(sub).value;
            sum = (suma - 0) + (sumb - 0);
            document.getElementById(sut).value = sum;
        }   
    }        
</script>

Do you know if it is feasible to add the result of this javascript function into the TextBoxFor?

I want to add Unique ID to my Radio button. My code is written in foreach loop. As it is generating same name and Id for all same buttons, but I want same name but Id should be different. Where should I add Id ?? Help please. My code is mentioned below:

 <fieldset class="TimeSection">
    <legend class="accessibleText"> <%= Resources.ChooseTime%> </legend>  
        <% var count = 0;%>
        <% foreach (var slot in Model.Slots)
           { %>
        <% if (count < 5)
           { %>
        <span>          
            <%=Html.RadioButton(model => model.Arrangement,slot.Number, slot.Available == false ? new { disabled = "disabled" } : null)%>

            <span <% if (!slot.Available){ %> class="disabled" <% } %>>
                <%= slot.SlotTime%></span>
            <% if (slot.Number == Model.ArrivalTimeslot)
               { %>
            <input type="hidden" name="ExistingTimeslot" value="<%=slot.Number%>" />
            <% } %>
        </span>
        <br />
        <br />
        <% } %>
        <% count = count + 1; %>
        <% } %>  
</fieldset>

I am completely new to d3.js. I am attempting to create a series of force directed graphs based on data held in Oracle.

All the documentation I have found so far seems to point to JSON as the interface between the data and d3.js. Currently I have an SQL query which is returning the data in a gridview. Can I get d3.js to look at this data, or must I somehow convert to JSON or use another method to expose JSON?

I am using aspx pages and Microsoft Expression. Most of the info. I have found online points towards php being the more common approach. Is aspx acceptable for use with d3.js? Are there any pitfalls which will prevent me from creating force directed graphs using aspx?

I am using Microsoft Expression rather than Visual Studio. Is this limiting the functionality I have in terms of API's etc.?

Thanks

I use VS 2015 RC for a while now and now I face the first issue. I started VS, clicked on my recent solution, but then the following Window opened:

enter image description here

The problem is that what ever button I press (Get, Cancel, Close Button) and which CheckBox I checked, VS does not respond accordingly. It's not frozen, but the behavior is like you just put nothing in to your Button_Click Method. I am basically stuck with this window now. Restarting VS and rebooting did not help. Is there a file that I can delete to get out of this cycle? Did somebody face this exact problem?

I am using Crystal Report 11 R2 . Recently we upgraded the server to windows 2012 Server and suddenly one of my report shows unexpected behaviour. It automatically removed all the spaces in the Report. Please help me in resolving the same. Instead of displaying "KITCHEN EQUIPMENT IN SEAWORTHY PACKING" it is showing as "KITCHENEQUIPMENTINSEAWORTHYPACKING".

One more thing to note is that The report is having arabic data also. Will it create any issue ??

Kindly help Experts !!!

(1) In asp.net with c#, In a asp.net page, Which loads first master page or web user control or custom control or asp.net page controls. (2) In the master page, which loads first custom control or web user control or master page controls.

if have seen the posts that tell you how to load data from database on scroll down event using ajax. but my problem is if the number of users increase the number of hits to the server database would be really large. I want to implement some kind of prefetching mechanism to reduce calls to the database. for example if i want to display 30 records i fetch 60 records from database. after displaying the first 30 records from the fetched data i would only make database call if there are no new rows in the fetched data.as the user is browsing through the lower 30 records 60 records would be prefetched and kept ready for use.

I have a radgrid and I want to have Both click and double click in it. I used a javascript code to fire double click but in some cases it returns "RowClick" Command to ItemCommand event! I have below code for it:

 <telerik:RadGrid ID="RadGrid_Mails" OnDataBound="RadGrid_Mails_DataBound" SkinID="<% $Resources:Strings,SkinID %>"
    OnSortCommand="RadGrid_Mails_SortCommand" AllowAutomaticDeletes="True" Width="99.8%"
    AllowSorting="True" AutoGenerateColumns="False" AllowPaging="True"
    runat="server" ShowFooter="True" AllowMultiRowSelection="True"
    AllowFilteringByColumn="True" Height="550px" HorizontalAlign="Center"
    ClientSettings-EnablePostBackOnRowClick="true"
    OnNeedDataSource="RadGrid_Mails_NeedDataSource"
    OnPreRender="RadGrid_Mails_PreRender"
    OnSelectedIndexChanged="RadGrid_Mails_SelectedIndexChanged"
    OnItemCommand="RadGrid_Mails_ItemCommand">
    <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
    <MasterTableView Width="100%" GridLines="None" CommandItemDisplay="Top" AllowSorting="true" AllowPaging="true"
    HorizontalAlign="Center" ClientDataKeyNames="Mokatebeh_ID"
    AllowAutomaticInserts="True">
        <CommandItemTemplate>
         .....
            <ClientSettings>
                <Scrolling AllowScroll="false" />
                <ClientEvents OnRowDblClick="RowDblClickMails" />
                <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"></Selecting>
            </ClientSettings>

</telerik:RadGrid>

javascript code:

var isDoubleClickMails = false;
            var clickHandlerMails = null;
            var ClickedIndexMails = null; 
        function RowDblClickMails(sender, args) {
                ClickedIndexMails = args._itemIndexHierarchical; // newly added
                isDoubleClickMails = true;
                if (clickHandlerMails) {
                    window.clearTimeout(clickHandlerMails);
                    clickHandlerMails = null;
                }
                clickHandlerMails = window.setTimeout(ActualClickMails, 200);
            }

            function ActualClickMails() {
                if (isDoubleClickMails) {
                    var grid = $find("<%=RadGrid_Mails.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];
                            if (ClickedIndexMails != null && ClickedIndexMails == i) { // newly added
                                MasterTable.fireCommand("RowDblClickMails", ClickedIndexMails); // newly added
                            } // newly added
                        }
                    }
                }
           }

code behind:

if (e.CommandName == "RowDblClickMails")
{ 
    //do something
}

I have a Crystal Report with following design enter image description here

enter image description here

Problem is, when I run the code I am unable to see Report Footer in the result.

NOTE that this happens when I add Page Footer otherwise it does show the Sum Total in the browser so I think it has something to do with Page Footer. Can anyone please identify the problem as I am new to Reporting.

Web app with scratch Website with scratch Need to know what is the meaning scratch word in development.

I want to create a facebook page that integrate payment method redirect through facebook ads offer.

App would illustrate to the user that they are in Facebook while redemption takes place on the back end and delivers a payment confirmation back to the user.

Ideally we envision the app

creating a page within FB when the user clicks on the facebook ads for "redeem offer". This window collects the necessary payment info. The payment info would send details to a shopping cart. The shopping cart would deliver confirmation info back to the user.

Again the primary objective of the app would be to collect and confirm payment info for FB Offers within FB (without having to go to an external URL)