I have been trying to get the "Contact Us" part of this aspx to show up after the "Custom dial" part, but for some reason no matter what I try the custom dial is appearing after, not before. Does anyone know what I need to do to get the contact us link to move to the right side of the custom dial? This is driving me crazy.

<div style="clear: both;">
    <asp:Panel ID="pnlLogo" runat="server" Visible="false" CssClass="logo_holder">
        <asp:HyperLink runat="server" ID="LogoLink">
            <asp:Image ID="imgLogoAdm" CssClass="logo" ImageUrl="~/Images/CompanyLogo.png" runat="server" />
        </asp:HyperLink>
        <span class="slogan"><strong>This is <br />
            Our Motto</strong></span>
        <span>
            <br />
            <asp:Label ID="Label1" runat="server" Width="25px">  </asp:Label>
            <asp:HyperLink runat="server" ID="CustomDialHyperlink">
                <asp:Image runat="server" ID="imgCustomDial" Width="160px" Height="80px" Visible="false" />
            </asp:HyperLink>
        </span>

        <span class="contact_info">
            <asp:HyperLink ID="ContactUs" NavigateUrl="~/ContactUs.aspx" runat="server"><strong>Contact Us</strong></asp:HyperLink>
        </span>

    </asp:Panel>
</div>

Thanks

I have a solution consisting of:

  • ASP.NET Core 2.1 running IdentityServer4 on top of ASP.NET Identity Core.
  • ASP.NET Core 2.1 Web API set to use the IdentityServer as the authentication provider.
  • A React SPA web application using oidc-client javascript library.

When I create new users I set some custom claims that are saved in the AspNetUserClaims table which looks like this: enter image description here

Then, on my API project, inside a controller I want to get those user claims of the authenticated user.
I was expecting this.User.Claims to get me those, but instead that's returning the following, which seem to be claims related to the client app, not the user.

enter image description here

How can I access those custom user claims (address, location, tenant_role) from a controller inside the Web API project?
Bare in mind that the API project doesn't have access to the UserManager class or anything ASP.NET Identity Core related.

I'm trying to create a table like figure. When I click Edit I need textbox of that row in column change to enable. ...

My event has this code. The problem is GVBookDetails.FindControl is returning null and I can't understand why because I have that control.

protected void btnEditQuantity_Click(object sender, EventArgs e)
{
    int productID = Convert.ToInt32((sender as Button).CommandArgument); // get productID from EditButton
    Book book = (Book)Session["BookID"]; // object instance to use in edit query

    TextBox textBox = GVBookDetails.FindControl("tbQuantityEdit") as TextBox;

    textBox.Enabled = true;
    int quantity = Convert.ToInt32(textBox.Text);
}

i write a webservice. when i run it in localhost it work fine. but after upload it in my host, it also work (register data in db). but show a error.

here is error message:

Server Error in '/' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
DOAdverisingModule.AdsModule.context_PostRequestHandlerExecute(Object sender, EventArgs e) +295
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +71

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3163.0


here is code of webservice

[WebMethod]
        public void insert_into_test_tbl(string name, int grade)
        {
            con = new SqlConnection(conString);
            SqlCommand cmd = con.CreateCommand();
            SqlTransaction tr;


            string comm = "insert into test_tbl (name, grade) VALUES(N'" +
                name + "', " +
                grade + ") ";

            cmd.CommandText = comm;

            if (con.State == ConnectionState.Closed)
                con.Open();

            tr = con.BeginTransaction();
            cmd.Transaction = tr;
            cmd.ExecuteNonQuery();
            tr.Commit();

        }

thanks

I would like to create a below report in asp.net sql server. User can select the project name and then would like to display below report. Please help.

enter image description here

select [dbo].[User].FirstName , TimesheetDate, TaskHour, dbo.Projects.ProjectName from [dbo].[Timesheet] inner join dbo.Projects on [dbo].[Timesheet].ProjectID=dbo.Projects.ProjectID inner join [dbo].[User] on [dbo].[User].UserId=[dbo].[Timesheet].UserID where dbo.Projects.ProjectID=1

How to escape quotes inside .cshtml file. I using razor mvc. I using If inside foreach

@for (int i = 1; i <= 4; i++)
{
    <div @(i == 1 ? "class=\"tab-pane active\"" : "class=tab-pane")>
    </div>
}

I using slash to escape quote but not working well.

The result <div class="&quot;tab-pane" active&quot;=""></div>

I want the result if for 1 will be <div class="tab-pane active"></div>

I am able to get values into ViewBag and then I am passing those values into the HTML page. The Problem I am facing is that once i am passing the value into HTML, I am not able to populate the value into the Dropdown List.

Following is my code for the same:

@using PagedList;
@using PagedList.Mvc;
@model IPagedList<NurseOneStop.SC.NurseProfile>

@{
ViewBag.Title = "People";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="peoplemain-container" ng-controller="connectCtrl">


<div class="row">
    <div class="search-box">
        @using (Html.BeginForm("People", "Nurse", FormMethod.Get))
        {

            <div class="j_searchName">
                <input class="form-control" name="FirstName" placeholder="Search by FirstName" value="@ViewBag.FilterNurseSearch.FirstName" />
                <input type="hidden" name="Connected" placeholder="Search Name" value="@(ViewBag.Connected == true ?"true":"false")" />

            </div>
            <div class="j_search2">
                <center><button type="submit" class="btn btn-primary sb">Search</button></center>
            </div>
        }
    </div>

    <div class="search-box">
        @using (Html.BeginForm("People", "Nurse", FormMethod.Get))
        {

            <div class="j_search">
                <input class="form-control" name="FirstName" placeholder="Search by FirstName" value="@ViewBag.FilterNurseSearch.FirstName" />
                <input type="hidden" name="Connected" placeholder="Search Name" value="@(ViewBag.Connected == true ?"true":"false")" />
            </div>

            <div class="j_search">
                <input class="form-control" name="LastName" placeholder="Search by LastName" value="@ViewBag.FilterNurseSearch.LastName" />
            </div>

            <div class="j_search">
                <input id="pinput" name="JobLocation" class="form-control" type="text" value="@ViewBag.FilterNurseSearch.JobLocation" placeholder="Enter a location">
                <input id="Latitude" name="Latitude" type="hidden" value="@ViewBag.FilterNurseSearch.Latitude">
                <input id="Longitude" name="Longitude" type="hidden" value="@ViewBag.FilterNurseSearch.Longitude">
            </div>


            <div class="j_search">
                <select class="form-control" name="Profession">
                    <option value="@ViewBag.Profession" selected>Select Profession</option>
                    @for (int i = 1; i < ViewBag.Profession.Count + 1; i++)
                    {
                        <option value=@i @(ViewBag.FilterNurseSearch.Profession == i ? "selected" : "")>@ViewBag.Profession[i].Text</option>
                    }
                </select>
            </div>


            <div class="form-group">
            @Html.LabelFor(model => model., new { @class = "control-label" })
            @Html.DropDownListFor(model => model.ParentProfessionId, (List<SelectListItem>)ViewBag.Profession, new { @class = "form-control" })
                @Html.DropDownListFor(model => model.ParentProfessionId, (List<SelectListItem>)TempData["TempModel"], new { @class = "form-control" })

            </div>

            <div class="j_search2">
                <center><button type="submit" class="btn btn-primary sb">Advance Search</button></center>
            </div>
        }
    </div>


</div>




@foreach (var item in Model)
{
    <div class="people_container">
        <div class="connect_profile"><img src="@(item.ProfileUrl== ""  ?"/image/placeholder.jpg" : @item.ProfileUrl)" title="@item.Title&nbsp;@item.FirstName&nbsp;@item.LastName" /></div>
        <div class="clear"></div>
        <div class="job_box">
            <p><b>@item.Title&nbsp;@item.FirstName&nbsp;@item.LastName</b></p>
            <p><span>@item.Profession</span></p>
        </div>
        <div class="job_box_btn">
            <button class="details_btn">
                @Html.ActionLink("View Nurse", "NurseView", "Nurse", new { NurseId = item.NurseId }, new { @class = "" })
            </button>

            <button class="details_btn">
                <a style="display:@(item.Status==0? "block": "none")" id="connect_@item.NurseId" NurseFriendId="@item.NurseFriendId" ng-click="InviteNurse(@item.NurseId, 1)">Connect</a>
                <a style="display:@(item.Status==1? "block": "none")" id="cancel_@item.NurseId" NurseFriendId="@item.NurseFriendId" ng-click="InviteNurse(@item.NurseId,3)">Cancel</a>
                <a style="display:@(item.Status==2 || item.Status==3? "block": "none")" id="message_@item.NurseId" NurseFriendId="@item.NurseFriendId" href="/Nurse/GetInbox?FromNurseId=@NurseOneStop.WebSite.Models.ApplicationSession.CurrentUser.NurseId&ToNurseId=@item.NurseId&FromRecruiterId=&ToRecruiterId=">Message</a>
                <div class="tick-right"><a style="display:@(item.Status==4? "block": "none")" id="accept_@item.NurseId" NurseFriendId="@item.NurseFriendId" ng-click="InviteNurse(@item.NurseId,2);"> <i class="fa fa-check"></i></a></div>
                <div class="tick-wrong"><a style="display:@(item.Status==4? "block": "none")" id="reject_@item.NurseId" NurseFriendId="@item.NurseFriendId" ng-click="InviteNurse(@item.NurseId,3);"><i class="fa fa-times"></i></a></div>

            </button>
        </div>
    </div>

}

<!--Confirm Modal -->
<div id="confirm" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content cancel-invitemodal">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Cancel the Invitation to Connect</h4>
            </div>
            <div class="modal-body cancel-invitetion">
                <h2>Are you sure you want to Cancel the Invitation to Connect</h2>
                <div class="cancel-box">
                    <input type="button" class="btn" ng-click="RequestCancel(SelectedNurseId,3)" value="CANCEL INVITE">
                    <input type="button" class="btn" ng-click="Cancel()" value="DO NOT CANCEL INVITE">
                </div>
            </div>
        </div>

    </div>
</div>

<div class="pagination">
    Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
    @Html.PagedListPager(Model, page => Url.Action("People", new { page, Connected = ViewBag.Connected, SearchName = ViewBag.SearchName }), PagedListRenderOptions.OnlyShowFivePagesAtATime)
</div>

</div>

@section scripts{

<script>
    function initMap() {
        var input = document.getElementById('pinput');
        var autocomplete = new google.maps.places.Autocomplete(input);
        autocomplete.addListener('place_changed', function () {
            var place = autocomplete.getPlace();
            console.log(JSON.stringify(place));
            if (!place.geometry) {
                window.alert("Autocomplete's returned place contains no geometry");
                return;
            }
            var latlong = JSON.parse(JSON.stringify(place.geometry.location));
            document.getElementById('Latitude').value = latlong.lat;
            document.getElementById('Longitude').value = latlong.lng;
        });
    }
    initMap();

    function showhide(id) {
        $("ul").hide();
        $("#newpost" + id).toggle();
    }

    $('#pinput').on('input', function () {
        document.getElementById('Latitude').value = '';
        document.getElementById('Longitude').value = '';
        // do your stuff
    });
</script>

}

Following is how I am using my controller:

public void DropDown()
    {
        ProfessionDAL objProfessionDAL = new ProfessionDAL();
        Profession objProfession = new Profession();
        List<Profession> objProfessionList = new List<Profession>();
        SelectListItem objSelect = new SelectListItem { Text = "Select Profession", Value = "", Selected = true };
        objProfessionList = objProfessionDAL.GetProfessionList().Results;
        var profession = (from kl in objProfessionList
                          select new SelectListItem
                          {
                              Text = kl.ProfessionName,
                              Value = kl.ProfessionId.ToString(),
                              Selected = false
                          }).ToList();
        profession.Insert(0, objSelect);
        ViewBag.Profession = profession;
    }


    public ActionResult People(bool Connected, int? page, FilterNurseSearch objFilterNurseSearch)
    {
        if (ApplicationSession.CurrentUser == null)
        {
            //redirect
            return RedirectToAction("Login", "Account");
        }
        DropDown();
        long NurseId = ApplicationSession.CurrentUser.NurseId;
        ViewBag.FilterNurseSearch = objFilterNurseSearch;
        Result objResult = objNurseDAL.GetNurses(NurseId, Connected, objFilterNurseSearch);

        int pageSize = 12;
        int pageNumber = (page ?? 1);
        ViewBag.Connected = Connected;
        return View(((List<NurseProfile>)objResult.Results).ToPagedList(pageNumber, pageSize));


    }

I know I am making a silly mistake which I am not able to catch and henceforth, ask my fellow developers to help me.

Is there a way to do a check on whether or not the following button has a certain class in the ng-disabled condition?

  <button ng-disabled="thisElementHasACertainClassAddedToIt" type="submit" id="btn-in" class="btn btn-primary">IN</button>

I want something that doesn't require the use of any kind of script (javascript, JQuery, ...), only html, AngularJS or Bootstrap. Something that I can just place as the condition and that doesn't refer to some code written in a script or controller (libraries are okay).

Thank you in advance!

When I change something in cshtml views in a compiled project, during debug, i got

InvalidCastException: Unable to cast object of type 'SZArray' to type 'Microsoft.CodeAnalysis.INamedTypeSymbol'

error and I need to stop debugger, and re-run the solution.

I remember that few months ago i can normally change .cshtml file and see modification without recompiling.

What is changed?

We are in a situation to get client Local IP (not global ip) to be retrieved through ASP.Net Application.

We found that it is not possible to get this through server, so we had tried to achieve this with

$(document).ready(function () {
    $.get('http://jsonip.com', function (res) {
        $('p').html('IP Address is: ' + res.ip);
    });
});

but we are getting Global IP, we need local ip address, can anyone help us with a solution, thanks in advance.

I'm trying to add a new claim to an existing token like this:

JwtSecurityTokenHandler tokenHandler = new JwtSecurityTokenHandler();
        JwtSecurityToken jwtToken = (JwtSecurityToken)tokenHandler.ReadToken(token);
        byte[] key = Convert.FromBase64String(secret);
        TokenValidationParameters parametrs = new TokenValidationParameters()
        {
            RequireExpirationTime = true,
            ValidateIssuer = false,
            ValidateAudience = false,
            IssuerSigningKey = new SymmetricSecurityKey(key)

        };
        SecurityToken securityToken;
        ClaimsPrincipal principal = tokenHandler.ValidateToken(token, parametrs, out securityToken);

        Claim myClaim=new Claim(property, value);
        ClaimsIdentity identity = new ClaimsIdentity();
        identity.AddClaim(myClaim);

        principal.AddIdentity(identity);  

During the execution of this method, a new claim is added to the principal, how do we associate or update the token with new data(principal)?

I am facing System.Threading.Tasks.TaskCanceledException while calling a webservice (lets say "Backend WebService") from an another webService (lets say "MainWebService") Asynchronously.

To create the PDF of a form, the MainWebServie should call the Backend WebService method CreatePDF(formId).

The Main WebService has an api Called ProcessForms() that contains a where comma separated formIds can be passed as parameter whose document (PDF) should be created.

The another webService, called BackgroundWebService. It contains a Method called CreatePDF() where individual formId can be pssed to create the PDF.

Since there could be up to 20 FormIds that can be separated by comma and passed as a parameter for Main Webservice method ProcessForms() to create the PDF of each, i want to call the backendWebService asynchronously from the Main WebService so that the user does not have to wait for all the PDFs to be created in front end and the process can happen in "Fire and Forget" manner.

Its working fine in most of the cases but recently i have noticed that there occurs a System.Threading.Tasks.TaskCanceledException almost once in weekend causing some of the records being terminated in middle of the process.

Please correct me if i have done wrong implementation somewhere:

    //Method of MainWebService where comma separated formIds can be passed whose PDF should be created
    public string ProcessForms(string suppliedFormIds)
    {
        //Get the Comma separated GUID to process 
        List<string> formIdList = suppliedFormIds.Split(',').Select(Convert.ToString).ToList();


        //Loop through each record and process the record asynchronously (Fire and Forget)
        for (int i = 0; i <= formIdList.Count; i++)
        {
            var queueId = formIdList[i].ToString();
            **this.ProcessFormRecord**(Guid.Parse(queueId));
        }
        return "Success";
    }


    // method that calls the backendWebService Asynchronously to create the PDF
    public **async void** ProcessFormRecord(Guid formId)
    {
        string message = string.Empty;
        HttpResponseMessage httpResponse = null;
        string webserviceUrl = "https://abcd.com/API/MyWebservice.svc";


        using (HttpClient client = new HttpClient())
        {
            client.BaseAddress = new Uri(webserviceUrl);
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            HttpRequestenter code hereMessage request = new HttpRequestMessage(HttpMethod.Post, webserviceUrl + "/CreatePDF");
            string content = "{\"formId\":\"" + formId.ToString() + "\"}";
            request.Content = new StringContent(content, Encoding.UTF8, "application/json");

            httpResponse = **await client.PostAsync**(request.RequestUri, request.Content);

        }
    }

I have a code for inserting data to my table. the data inserting works correctly. but it doesn't insert the DateTime that user inserts it, and when i want to show my data it doesn't convert DateTime field of my table to Persian Calendar that I insert it before this is my code :

    <asp:GridView ID="gvEmployees" CssClass="gridStyle" runat="server" Caption="کارمندان موجود در پایگاه داده" DataSourceID="sqlDtSrcEmployees" AutoGenerateColumns="False">
            <AlternatingRowStyle BackColor="#FF99CC" />
            <Columns>
                <asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" SortExpression="EmployeeID" />
                <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
                <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
                <asp:BoundField DataField="HireDate" HeaderText="HireDate" SortExpression="HireDate" />
            </Columns>
            <EditRowStyle BackColor="#FF99CC" />
            <HeaderStyle BackColor="#FF66CC" Font-Bold="True" Font-Names="Calibri" ForeColor="White" />
            <RowStyle BackColor="#FFCCFF" Font-Names="Calibri" HorizontalAlign="Center" />
        </asp:GridView>


        <asp:SqlDataSource ID="sqlDtSrcEmployees" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString2 %>"
            InsertCommand="INSERT INTO [Employees] ([LastName], [FirstName], [HireDate]) VALUES (@LastName, @FirstName, @HireDate)"
            SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [HireDate] FROM [Employees]">
            <InsertParameters>
                <asp:ControlParameter ControlID="txtLastName" Name="LastName" PropertyName="Text" Type="String" />
                <asp:ControlParameter ControlID="txtFirstName" Name="FirstName" PropertyName="Text" Type="String" />
                <asp:Parameter Name="HireDate" Type="DateTime" />
            </InsertParameters>
        </asp:SqlDataSource>

 protected void gvEmployees_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    DateTime usDate = (DateTime)DataBinder.Eval(e.Row.DataItem, "HireDate");
                    System.Globalization.PersianCalendar faDate = new System.Globalization.PersianCalendar();

                    string day = faDate.GetDayOfMonth(usDate).ToString("D2");
                    string month = faDate.GetMonth(usDate).ToString("D2");
                    string year = faDate.GetYear(usDate).ToString("D4");

                    e.Row.Cells[3].Text = string.Format("{0} / {1} / {2}", year, month, day);
                }
            }
            catch { }
        }

        protected void sqlDtSrcEmployees_Inserting(object sender, SqlDataSourceCommandEventArgs e)
        {
            try
            {
                int day = Convert.ToInt32(TxtHireDay.Text);
                int month = Convert.ToInt32(TxtHireMonth.Text);
                int year = Convert.ToInt32(TxtHireYear.Text);

                System.Globalization.PersianCalendar faDate = new System.Globalization.PersianCalendar();
                e.Command.Parameters["@HireDate"].Value = faDate.ToDateTime(year, month, day, 23, 0, 0, 0);
            }
            catch { }
        }
        protected void Button1_Click1(object sender, EventArgs e)
        {
            sqlDtSrcEmployees.Insert();
        }

I do not know why it does not work؟!

We have a asp website and it has been deployed on IIS. We have scenario where an issue is reported on the released web site, for that we should debug the release website locally. We did attach the process of running web site(w3wp.exe) but the breakpoint in aspx.cs file is not getting hit(symbols are not getting loaded).We tried to find the .dll and .pdb files related to aspx.cs(Not even in ASPNetTemporaryFiles) but we dint succeed in doing so.

I am currently developing a ASP.NET MVC 5 site which uses the Microsoft Graph API application to retrieve and insert data into Microsoft Planner. Said site already has Azure Active Directory authentication. I am currently using the following code to get the access token to login into the Graph API application.

    public async Task<ActionResult> SignIn()
    {
        AuthenticationContext authContext = new AuthenticationContext("https://login.microsoftonline.com/common");
        string redirectUri = Url.Action("Authorize", "Planner", null, Request.Url.Scheme);
        Uri authUri = await authContext.GetAuthorizationRequestUrlAsync("https://graph.microsoft.com/", SettingsHelper.ClientId,
                                                              new Uri(redirectUri), UserIdentifier.AnyUser, null);

        // Redirect the browser to the Azure signin page
        return Redirect(authUri.ToString());
    }

    public async Task<ActionResult> Authorize()
    {
        // Get the 'code' parameter from the Azure redirect
        string authCode = Request.Params["code"];

        // The same url we specified in the auth code request
        string redirectUri = Url.Action("Authorize", "Planner", null, Request.Url.Scheme);

        // Use client ID and secret to establish app identity
        ClientCredential credential = new ClientCredential(SettingsHelper.ClientId, SettingsHelper.ClientSecret);

        TokenCache fileTokenCache = new FilesBasedAdalV3TokenCache("C:\\temp\\justin.bin");
        AuthenticationContext authContext = new AuthenticationContext(SettingsHelper.AzureADAuthorityTenantID, fileTokenCache);
        AuthenticationResult authResult = null;
        try
        {
            // Get the token silently first
            //authResult = await authContext.AcquireTokenSilentAsync(SettingsHelper.O365UnifiedResource, credential, new UserIdentifier("mmccarthy@hmvella.com", UserIdentifierType.RequiredDisplayableId));
            authResult = await authContext.AcquireTokenAsync(SettingsHelper.O365UnifiedResource, credential);
        }
        catch (AdalException ex)
        {
            authContext = new AuthenticationContext(SettingsHelper.AzureADAuthority, fileTokenCache);

            authResult = await authContext.AcquireTokenByAuthorizationCodeAsync(
            authCode, new Uri(redirectUri), credential, SettingsHelper.O365UnifiedResource);

            return Content(string.Format("ERROR retrieving token: {0}", ex.Message));
        }
        finally
        {
            // Save the token in the session
            Session["access_token"] = authResult.AccessToken;
        }

        return Redirect(Url.Action("Index", "Planner", null, Request.Url.Scheme));
    }

The code above gets the access token without any issue. I am able to get all users of the active directory without any issue and store them in a database. However when I try to get any data relating to a task I keep on getting the following error

{  
   StatusCode:401,
   ReasonPhrase:'Unauthorized',
   Version:1.1,
   Content:System.Net.Http.StreamContent,
   Headers:{  
      Transfer-Encoding:      chunked request-id:40      b53d20-c4fc-4614-837b-57a6bebb8d79 client-request-id:40      b53d20-c4fc-4614-837b-57a6bebb8d79 x-ms-ags-diagnostic:{  
         "ServerInfo":{  
            "DataCenter":"North Europe",
            "Slice":"SliceC",
            "Ring":"2",
            "ScaleUnit":"000",
            "Host":"AGSFE_IN_17",
            "ADSiteName":"NEU"
         }
      }      Duration:28.4537      Strict-Transport-Security:      max-age=31536000 Cache-Control:      private Date:Fri,
      07      Dec 2018 14:12:50      GMT Content-Type:application/json
   }
}

I have checked azure app and it has full access rights. Any Help on this would be greatly appreciated

I'm making a research on options for serving very big files using ASP.Net hosted on IIS. My understanding of big file in this scenario is a file does not fit into memory for example 100 GB big.

What are the best pracices in this area and what should I pay special attention to?

I'm using a standard MySql database to get data to display on my Website. The problem is that I get a open DataReader exception once multiple users try to access the website at the same time/ one user "spam" clicks certain requests. I'm not sure how to fix this. I thought about caching results to reuse but that doesn't keep the results new and doesn't fix it for different kind of requests. How do i allow users to access at the same time and prevent the readeraccess from overlapping with other sql requests?

Example method that uses a reader:

        public User GetUserData(uint id)
    {
        DbDataReader reader = this.Select("* FROM " + Table.user + " WHERE id=" + id + " LIMIT 1");

        User user = new User()
        {
            UserId = id,
            Username = reader[UserTable.username].ToString(),
            Firstname = reader[UserTable.firstname].ToString(),
            Lastname = reader[UserTable.lastname].ToString(),
            Email = reader[UserTable.mail].ToString(),
            Birthdate = DateTime.Parse(reader[UserTable.birthday].ToString()),
            Password = reader[UserTable.password].ToString(),

        };

        reader.Close();
        return user;
    }

Thanks in advance

Jan

I'm using the input tag helper for my Razor view like so:

<input type="text" asp-for="MsgFromFilter" id="txtMsgFromFilter" />

So this should be bound to my model's MsgFromFilter string field. Although, when I submit the form, this field in my model is bound to the value in the textbox, it doesn't work the other way round: when I set the value of this field in my controller, the view doesn't set that as the default value of the text input element; it just maintains the last value submitted in that input field. How can I get the text input to default its value on page load to the value in the model rather than the last value that was submitted in the input?

I used Entity Framework to generate my controller and view for my class.

This is what I have:

DemandeController.cs (controller):

    public ActionResult Create()
    {
        Demande model = new Demande();
        model.date = DateTime.Now;
        model.status = "en cours";

        Employe emp = (Employe)Session["currentUser"];
        model.Employe = emp;

        ViewBag.ServiceID = new SelectList(db.Services, "id", "nom");
        ViewBag.EmployeID = new SelectList(db.Employes, "matricule", "nom");
        return View(model);
    }

Demande -> Create.cshtml (View)

    <div class="editor-label">
        @Html.LabelFor(model => model.EmployeID, "Employe")
    </div>
    <div class="editor-field">
        @Html.DropDownList("EmployeID", String.Empty)
        @Html.ValidationMessageFor(model => model.EmployeID)
    </div>

Employe class:

public partial class Employe
{
    public Employe()
    {
        this.ActivityLogs = new HashSet<ActivityLog>();
        this.Demandes = new HashSet<Demande>();
    }

    public int matricule { get; set; }
    public int DepartementID { get; set; }
    public string nom { get; set; }
    public string prenom { get; set; }
    public string telephone { get; set; }
    public string adresse { get; set; }
    public string fonction { get; set; }
    public string username { get; set; }
    public string password { get; set; }
    public string role { get; set; }
    public Nullable<bool> isAdmin { get; set; }

    public virtual ICollection<ActivityLog> ActivityLogs { get; set; }
    public virtual ICollection<Demande> Demandes { get; set; }
    public virtual Departement Departement { get; set; }
}

Demande class:

public partial class Demande
{
    public int id { get; set; }
    public int EmployeID { get; set; }
    public int ServiceID { get; set; }
    public Nullable<System.DateTime> date { get; set; }
    public string status { get; set; }
    public string details { get; set; }

    public virtual Service Service { get; set; }
    public virtual Employe Employe { get; set; }
}

By default, because I have many employees, the view generates a dropdownlist where I have to chose the employe name. That works without problems.

However, I am trying to change the dropdownlist into a textbox that would display the currently logged-in employe which is saved in a session object.

I tried a lot of things such as saving the Employe object in the model from the Controller like you can see in the Controller code above but it did not work as the View does not save the entire object to my understanding so when I submit, it overrides the Employe object and only leaves the name attribute. It worked for the date and status because they are basic objects but not for Employe.

I tried explaining to the best of capacity, I'm fairly new to ASP.NET MVC. If there is any further information you'd like me to provide, just let me know.

I am using datatables.net for a web application developed by ASP.NET and C# for backend code. I have a with the property runat=“server”. I am filling this div with the html table structure from code behind using the function InnerHtml.

Now, when I initialize the datatable by calling Jquery, datatable is not working. However, in the same aspx page, i have another table which does not runat server and is working fine.

How do I overcome this issue. In other word, how will I utilize jquery for DOM that runs on server side?