ASPNET

asp.net – Can’t Install DNN 6.2.9 – 302 Redirect Loop Timeout


I’m trying to install DNN version 6.2.9 (I have to use this version for the client I’m working with), but I’m not being able to get the installer to work. I’ve followed all the steps at this link: http://www.dnnsoftware.com/wiki/how-to-install-dotnetnuke

When I get to the step where I’m supposed to go to the installation wizard on localhost, step 10, the browser-based installer isn’t loading. When I investigated the network traffic, it appears the installer is trapped in a 302 redirect loop and the request to the server is timing out. Below are the two urls it keeps alternating between. Any thoughts on what could be causing this? I suspect some kind of permissions or maybe db access problem, but I haven’t been able to find a solution yet.

Local host prefix: localhost/dotnetnuke

Two .aspx files it keeps alternating between:

login.aspx?ReturnUrl=%2fdotnetnuke%2fInstall%2fInstallWizard.aspx

Install/InstallWizard.aspx



لینک منبع

asp.net – A member of the type, ‘Id’, does not have a corresponding column in the data reader with the same name


I’m exposing a stored procedure via a SqlQuery in an Azure .NET backend with App Service. When the query is executed though, I get this error:

A member of the type, 'Id', does not have a corresponding column in the data reader with the same name

I’m not exactly sure why the data reader is trying to reference/map to the Id column because it’s not part of the columns I select from the sproc query.

This is my code:

CREATE PROCEDURE IndividualAverages @AccountId nvarchar,@StartDate datetime,@EndDate datetime
AS
BEGIN

print 'SELECT DISTINCT AccountId,AlertDate,CreatedAt,UpdatedAt,Version,Deleted, (CAST(Consumed AS real) / Total - Pending) * 100 AS Percentage FROM dbo.Statistics WHERE AccountId = @AccountId AND AlertDate BETWEEN @StartDate AND @EndDate'

END

And this is my SqlQuery:

var paramId = new System.Data.SqlClient.SqlParameter("@userId", user_accountId.Trim());
var paramDateStart = new System.Data.SqlClient.SqlParameter("@StartDate",newStartDate.ToUniversalTime());
var paramDateEnd = new System.Data.SqlClient.SqlParameter("@EndDate", newEndDate.ToUniversalTime());

var userAverage = context.IndividualAverage.SqlQuery("EXEC dbo.IndividualAverages @userId,@StartDate,@EndDate" , paramId, paramDateStart, paramDateEnd).ToList();



لینک منبع

How to make globalize or internationalize web application with Asp.Net MVC?


I need to develop web module for multiple countries ,
so i want to know, what is best practice for develop internationalize website,
i refer so many articles from different different resources,
but i want to need some suggestions if possible,
like can i use database driven resources rather than .resx file or how to make currencies,date format change in Internationalize website?

Please help me regarding this and Thanks in advance.



لینک منبع

c# – javascript timer in gridview asp.net


In my product table i have a start date and end date. I want to show a countdown timer in my asp.net gridview such that when it expires it will show “Project Finished”

This is the code i have tried. It is showing the countdown timer. But it is not showing inside the gridview and the gridview itself disappears and also when it expires it starts showing minus sign. Also, i want to get the end date from the sql database and not a hard coded date. Finally, i want when it comes to an end it will display “Project Ended” in red font colour. Please, i need your help friends:
This is the aspx page:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:UpdatePanel runat="server" ID="TimedPanel" UpdateMode="Conditional">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="UpdateTimer" EventName="Tick" />

            </Triggers>
            <ContentTemplate>
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="3" DataSourceID="SqlDataSource1" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" ForeColor="Black" GridLines="Vertical" Width="1223px" DataKeyNames="ProjectID" Height="138px">
                    <Columns>
                        <asp:CommandField ShowEditButton="True" />
                        <asp:BoundField DataField="ProjectID" HeaderText="ProjectID" InsertVisible="False" ReadOnly="True" SortExpression="ProjectID" > </asp:BoundField>
                        <asp:BoundField DataField="ProjectTitle" HeaderStyle-Width="500px" HeaderText="ProjectTitle" HtmlEncode = "false" SortExpression="Title" > </asp:BoundField>
                        <asp:BoundField DataField="StartDate" HeaderText="StartDate" SortExpression="StartDate" DataFormatString="{0:dd/MM/yyyy}" HtmlEncode="false"> </asp:BoundField>
                        <asp:BoundField DataField="EndDate" HeaderText="EndDate" SortExpression="EndDate" DataFormatString="{0:dd/MM/yyyy}" HtmlEncode="false"> </asp:BoundField>
                        <asp:BoundField DataField="Duration" HeaderText="Duration" SortExpression="Duration" > </asp:BoundField>
                        <asp:BoundField DataField="StateName" HeaderText="State" SortExpression="State" > </asp:BoundField>
                        <asp:BoundField DataField="LGName" HeaderText="LGName" SortExpression="LGA" />
                        <asp:BoundField DataField="CommunityName" HeaderText="Community" SortExpression="Community" />
                        <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
                        <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
                        <asp:BoundField DataField="Year" HeaderText="Year" SortExpression="Year" />
                        <asp:BoundField DataField="CompanyName" HeaderText="Company" SortExpression="Company" />
                        <asp:TemplateField HeaderText="CountDown">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="DateStampLabel" />

                            </ItemTemplate

                        </asp:TemplateField>

                    </Columns>
                    <FooterStyle BackColor="#CCCCCC" />
                    <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                    <AlternatingRowStyle BackColor="#CCCCCC" />
                    <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#F1F1F1" />
                    <SortedAscendingHeaderStyle BackColor="#808080" />
                    <SortedDescendingCellStyle BackColor="#CAC9C9" />
                    <SortedDescendingHeaderStyle BackColor="#383838" />

                </asp:GridView>
                <asp:Label runat="server" ID="DateStampLabel" />

            </ContentTemplate>

        </asp:UpdatePanel>
        <asp:Timer runat="server" ID="UpdateTimer" Interval="1000" OnTick="UpdateTimer_Tick" />

    </div>

    </form>

</body>

</html>

Code behind:

protected void UpdateTimer_Tick(object sender, EventArgs e)
    {
        if (GetEndDate() == CurrentTime())
        {
            DateStampLabel.Text = "Project Ended";
            UpdateTimer.Enabled = false;
        }

        {
            DateStampLabel.Text = (GetEndDate() - CurrentTime()).ToString();
        }
    }

    private DateTime CurrentTime()
    {
        string FormatDate = "MM/dd/yyyy HH:mm:ss";
        DateTime currentServerTime = DateTime.Now.AddHours(0);

        return DateTime.Parse(currentServerTime.ToString(FormatDate));
    }

    public DateTime GetEndDate()
    {
        return new DateTime(2017, 07, 25, 00, 00, 00);
    }



لینک منبع

Working with asp.net mvc routes


As I am new to .NET so Can anyone please guide me in steps to submit form data using asp.net MVC 4.

               My form is
            <div class="modal-content">
            <section id="content1">
                <form action="formdata" method="post">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h1 class="modal-title">Signup Form</h1>
                    </div>
                    <div class="modal-body">
                        <input type="text" placeholder="Username" required="" id="usernamecomapany" />
                        <input type="text" placeholder="Admin Name" required="" id="admincomapany" />
                        <input type="text" placeholder="Address" required="" id="addresscomapany" />
                        <input type="email" placeholder="Email" required="" id="emailcomapany " />
                        <input type="password" placeholder="Password" required="" id="passwordcomapany" />
                        <input type="password" placeholder="Confirm Password" required="" id="confirmpasswordcomapany" onkeydown="confirmPass()" />
                        <br>
                        <span id="message"></span>
                    </div>
                    <div class="modal-footer" style="padding-left: 86px">
                        <input type="submit" id="submitbutton" value="SignUp" style="background-color: whitesmoke" />
                    </div>
                </form>
                <!-- form -->
            </section>
            <!-- content -->
            <!-- container -->
            //
        </div>




 my controller function is




     public void formdata()
{
    Console.Write("test");
}  

how i set route to make this function work.. as i am getting error resource not found/url not found.



لینک منبع

ASP.NET MVC code first many to many (bridge) table


I started working with code first approach. It’s kindda confusing… anyway I need to know how can I CRUD something using the bridged table. Let’s for example say that I have 3 tables.(1 of which is the bridge table). Let’s name them foo1 and foo2 while foo3 will be our bridge table. Now let’s say I need to save a item from foo1 to foo2 (using the corresponding ID’s in foo3). How do I do that? And basically the whole CRUD. Examples and resources would be helpful.



لینک منبع

ASP.NET Core Post Action returns null


I have a simple controller method that should return a JSON result but returns null. I need to call it using jQuery $.ajax. I tested it using Postman and it does return null. I am not sure what I am doing wrong.

I tested it with Postman using the following JSON data and it returns null:

{ "id": 2 }

Here is the controller method:

// Post: Contact
[HttpPost, ActionName("GetContact")]
public JsonResult GetContactPost([FromBody] long id)
{
    var contact = _context.Contact.SingleOrDefault(m => m.ContactId == id);
    return Json(contact);
}

In my application I am using the following JavaScript and it returns null as well:

function GetContact(id) {
    $.ajax({
        type: "POST",
        url: "@Url.Action("GetContact","Contacts")",
        data: { id: id },
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (result) {
            alert("id: " + id + " result: " + result);
        },
        failure: function (response) {
            alert(response.d);
        }
    });
}



لینک منبع