I am getting the error "$(...).datepicker() is not a function as I try to set a bootstrap datepicker on a form field in my MVC/razor form. I've read similar posts and can't seem to get their solutions to work. It seems like the order of dependencies matters. Any advice would be appreciated. I've referenced this as one solution I've tried without success. How to add Date Picker Bootstrap 3 on MVC 5 project using the Razor engine?

Script Block

<script src="~/Scripts/jquery-3.1.1.js"></script>
<script src="~/Scripts/jquery-3.1.1.min.js"></script>
<script src="~/Scripts/moment.js"></script>
<script src="~/Scripts/bootstrap-datepicker.js"></script>
<link href="~/Content/bootstrap-datepicker.css" rel="stylesheet" />
<link href="~/Content/bootstrap.min.css" rel="stylesheet"/>
<script type="text/javascript">
    $(function () {
        $('.datepicker').datepicker();

    });
</script>

Form Field

<div class="form-group">
            @Html.LabelFor(model => model.TrainingDate, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.TrainingDate, new { htmlAttributes = new { @class = "form-control datepicker" } })
                @Html.ValidationMessageFor(model => model.TrainingDate, "", new { @class = "text-danger" })
            </div>
        </div>

I want create a page to convert my office file to pdf and save to a folder on my project. Is it possible?

I've been racking my brains on this for the last 2 hours, would be glad if anyone could assist.

I've got an ASP.NET website loaded on my local machine, (File, Open, Website) and usually it builds and runs fine, however this morning it's giving me weird error messages when building E.G 'Guid' does not contain a definition for 'NewGuid'. See screenshot.

enter image description here

What I've tried:

  1. Closing and Opening VS (version 2017 Community, btw)
  2. Deleting all temporary ASP files.

Only thing I can think that's changed was last night I was working on Xamarin and run some updates for the Xamarin components, doubt whether this would have messed with System though?

Thanks everyone...

I am working to convert a .NET MVC 5 application to core. I am using an IdentityServer4 for Authentication/Authorization and I cannot seem to get the logout working.

public async Task Logout()
{
    await HttpContext.Authentication.SignOutAsync("Cookies");
    await HttpContext.Authentication.SignOutAsync("oidc");
    return Redirect("/");
}

I am using this line to logout, but when I do I see it redirect me back to the login url (because you need to be authenticated for "/") and it logs me back in automatically. I have tried to delete the cookies in the logout method and no dice.

There is nothing in the IdentityServer log outside of the user is logged back in, so I don't think it's a configuration issue (worked in MVC5). Has anyone else had this issue? I think it's a small configuration issue that I am missing or logging out incorrectly.

I have tried this (below) but it throws a 404 on the /connect/endsession url. I think the token is too large for the url (2700+ characters).

public async Task Logout()
{
    return SignoutAsycn("Cookies", "oidc");
}

My only thought, when working in the MVC5 app I was debugging using the url localhost.xyz.com and the login server was login.xyz.com. Now I am debugging using localhost:44300 and login.xyz.com. The redirect url is setup to be https://localhost:44300.

Any help would be appreciated.

I am getting the Input string was not in a correct format error on this following line:

HDT = HAdapter.Select_By_SNAME_BLOCKNO(UDT.Rows[0]
["societyname"].ToString(), Convert.ToInt32(UDT.Rows[0]
["Houseid"].ToString()));

This is the definition of Select_By_SNAME_BLOCKNO :

    public virtual DS_HOUSE.HOUSE_SELECTDataTable Select_By_SNAME_BLOCKNO(string sname, global::System.Nullable<int> bno) {
        this.Adapter.SelectCommand = this.CommandCollection[5];
        if ((sname == null)) {
            this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value;
        }
        else {
            this.Adapter.SelectCommand.Parameters[1].Value = ((string)(sname));
        }
        if ((bno.HasValue == true)) {
            this.Adapter.SelectCommand.Parameters[2].Value = ((int)(bno.Value));
        }
        else {
            this.Adapter.SelectCommand.Parameters[2].Value = global::System.DBNull.Value;
        }
        DS_HOUSE.HOUSE_SELECTDataTable dataTable = new DS_HOUSE.HOUSE_SELECTDataTable();
        this.Adapter.Fill(dataTable);
        return dataTable;
    }

Code for Stored Procedure Select_By_SNAME_BLOCKNO:

   Create procedure Select_By_SNAME_BLOCKNO
   @sname nvarchar(50),
   @bno int
 AS
 BEGIN
   select * from dbo.HouseMst where Sname =@sname and BlockNo =@bno
 END

What is going wrong here ?

I was reading about MVC and had a discussion with a colleague regarding sessionless state and it's advantages such as handling AJAX callbacks in parallel, but he was not sure how authentication and authorization especially user session timeout would work. After reading more about MVC, I think, using cookies or membership providers may be the answer to his questions but still not sure if I am understanding it correctly.

I've got a Button called ButtonCreator when you click on it a click event called ButtonCreator_OnClick is fired, inside the function I've created a button dynamically, now how do I create on click event for that button?

the code:

private void ButtonCreator_OnClick(object sender, EventArgs e)
{
Button button = new Button();
button.Click += (object s, EventArgs eb) => {};
}

now when I click on the button the page is post back and the control is gone, how do I make the function inside the event handler work?

We have an ASP.NET Core application which has the default authentication system and is hosted on Azure. Recently, we created a new AppService and routed the users to that service while maintaining connection to the same database.

However, when users use the new server, we get continuous crashes with the following error:

The key {xxx-xxx-xxx-xxx} was not found in the key ring.

of type

System.Security.Cryptography.CryptographicException

and method

Microsoft.AspNetCore.Antiforgery.Internal.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken)

Our understanding is that the server is trying to decrypt the token but since it was received from a different server, our server just crashes.

We would so much appreciate if you can suggest a way to solve this issue temporarily until we change the DataProtection provider.

We want a way that wouldn't let our server crash.

Thank you so much

Update: I'm surprised now that this error happens in: POST Account/Login and POST Account/Register while these methods do not require authorization, however these methods are decorated with:

[ValidateAntiForgeryToken]

Both Get Account/Login and Post Account/Login happen on the same server.

here i use sql dependancy method for changeing db: 1. i want get notification counter like fb on every change in db

  public static void dependency_OnChange(object sender, SqlNotificationEventArgs e)
           {
            if (e.Type == SqlNotificationType.Change)
            {


                 SqlDependency sqlDep = sender as SqlDependency;
                 sqlDep.OnChange -= dependency_OnChange;
                //  string message="added";
               GlobalHost.ConnectionManager.GetHubContext<MyHub>();
                 context.Clients.All.notify("added");
                // from here we will send notification message to client


            }


        }

here is my jquery code where i want to get notification counter:

but code is not working and string value is not handled from sqldependancy method.

$(function()
              {


              // Proxy created on the fly
              var job = $.connection.myHub;

              // Declare a function on the job hub so the server can invoke it
              job.client.notify = function (message) {
                // 

                if (message && message.toLowerCase() == "added") {
                      updateNotificationCount();
                   }

              };
              // Start the connection

                $.connection.hub.start();
                updateNotificationCount();
          });    


              function updateNotificationCount() {
                  var count = 10;
                  count = parseInt($('#noti_Counter').html()) || 0;
                  count++;
                  $('#noti_Counter')
              .css({ opacity: 0 })
              .text(function () {
                  return "" + count + "";
              })
                   // ADD DYNAMIC VALUE (YOU CAN EXTRACT DATA FROM DATABASE OR XML).
              .css({ top: '-10px' })
               //.append('' + count + '')
              .animate({ top: '-2px', opacity: 1 }, 500);
              }

I am getting the following error when I click on the login button:

There is no row at position 0.

Specifically from the Image3.ImageUrl = HDT.Rows[0]["image"].ToString(); line.

Here is the block of code where i am getting error :

   DS_HOUSE.HOUSE_SELECTDataTable HDT = new 
   DS_HOUSE.HOUSE_SELECTDataTable();
   DS_HOUSETableAdapters.HOUSE_SELECTTableAdapter HAdapter = new 
   DS_HOUSETableAdapters.HOUSE_SELECTTableAdapter();

protected void Page_Load(object sender, EventArgs e)
{
 UDT = UAdapter.Select_By_UID(Convert.ToInt32(Session["uid"].ToString()));
 HDT = HAdapter.Select_By_SNAME_BLOCKNO(UDT.Rows[0]
["societyname"].ToString(), Convert.ToInt32(UDT.Rows[0]
["Houseid"].ToString()));

Image3.ImageUrl = HDT.Rows[0]["image"].ToString();
lblsname.Text = HDT.Rows[0]["sname"].ToString();
lblbno.Text = HDT.Rows[0]["blockno"].ToString();
lbltype.Text = HDT.Rows[0]["type"].ToString();
ViewState["HID"] = HDT.Rows[0]["HID"].ToString();
 }

I am attaching the link to my project along with database backup file.

http://www.filehosting.org/file/details/681537/ONLINE%20HOUSING%20CO-OPERATIVE%20SOCIETY%20MANAGEMENT%20SYSTEM.rar

Please run this project and help in solving this error because i am a beginner in this topic. I am reposting this question with project code as i wasnt able to get any answer.

This question already has an answer here:

It is my default class Login

 public partial class Login : System.Web.UI.Page
{


public string Insert;


    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public void reset()
    {
        login.Text = "";
        haslo.Text = "";
    }

    protected void Button1_Click(object sender, EventArgs e)
    {

        Insert = login.Text;
    }
    ...

I want to use "Insert" public string in another class but when i'm putting

public partial class Account : System.Web.UI.Page 
{

string var = Login.Insert;
}

in class "Account" i get an error " 'Login' does not contain a definition for 'Insert'"

I do not know where is the problem, i am looking for any solution.

Basically I need user data to be available on all pages in the site. I need to display some user properties in the layout, like:

[Username], [FirstName], [LastName], [Email], [IsEmailVerified], [Phone], [LastLoginDate], and 4 more properties...

But, these aspects need to be considered:

  1. No use of Session (I disabled it in my application).
  2. No database interaction on each request in order to get those user properties - I want to get them properties once and store them somewhere available.
  3. I use Forms Authentication.

Now, from a little search I made, I found this article from 2008, posted by Microsoft, about Forms Authentication: Storing Additional User Data in the Ticket, and Using a Custom Principal.

I think this is the closest approach, because now I use User.Identity.Name to get only the [Username] stored in the authentication ticket, and I love using it because it is quick, available and simple.

But I also have a few questions that bother me with this approach:

  1. This was posted in 2008, is it still relevant for 2017? is there something better and new today?
  2. As you can see above, I have quite a bit user properties that need to go into the auth cookie, and as I read - a lot of user data in the auth cookie is not reccomended...

Thanks for the helpers.

Created a simple calculator app in webforms. User enters a number in a text field MainContent_numberTb and clicks on results button.

Added a new 'coded UI Test Project' to my solution. Have tested the UI by adding '5', This all works fine. Would now like to compare the actual result against the expected result.

BrowserWindow Browser = BrowserWindow.Launch("http://localhost:37426/Calculator");

UITestControl UiInputField = new UITestControl(Browser);
UiInputField.TechnologyName = "Web";
UiInputField.SearchProperties.Add("ControlType", "Edit");
UiInputField.SearchProperties.Add("Id", "MainContent_numberTb");

//Populate input field
Keyboard.SendKeys(UiInputField, "5");

//Results Button
UITestControl ResultsBtn = new UITestControl(Browser);
ResultsBtn.TechnologyName = "Web";
ResultsBtn.SearchProperties.Add("ControlType", "Button");
ResultsBtn.SearchProperties.Add("Id", "MainContent_calBtn");

Mouse.Click(ResultsBtn);

All above code works fine, problem occurs when trying to access the label

<asp:Label ID="AllNumLbl_Res" runat="server"></asp:Label>

What do I insert beside control type? It's not edit as edit is the text field. Then also, what stores the actual result so I can compare AllNumsTB?

string expectedAllNums = "1, 2, 3, 4, 5";
UITestControl AllNumsTB = new UITestControl(Browser);
AllNumsTB.TechnologyName = "Web";
AllNumsTB.SearchProperties.Add("ControlType", "?????");
AllNumsTB.SearchProperties.Add("Id", "MainContent_AllNumLbl_Res");

if(expectedAllNums != AllNumsTB.??????)
{
    Assert.Fail("Wrong Answer");
}

UPDATE OK so using the debugger console I was able to get the value of the label using ((Microsoft.VisualStudio.TestTools.UITesting.HtmlControls.HtmlSpan)new System.Collections.ArrayList.ArrayListDebugView(((System.Collections.CollectionBase)(AllNumsTB.FindMatchingControls()).List).InnerList).Items[0]).DisplayText

but when I use this in the code & ArrayListDebugView are inaccessible due to protection??

I am trying to load some of the views from the database as described in here. So I want to use EF Core in the File provider.

RazorViewEngineOptions has a FileProviders property that you can add your file provider to. The problem is that you have to give it an instace of the file provider. So you'll need to instantiate all of the file providers' dependencies right there in Startup's ConfigureServices method.

Currently I inject an instance of IServiceProvider into the Configure method of Startup. Then I store the instance in a field (called _serviceProvider):

IServiceProvider _serviceProvider;
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceProvider provider)
{
   _serviceProvider = provider;
   ...
}

Then in ConfigureServices I use that field to instanciate the UIDbContext.

services.Configure<RazorViewEngineOptions>(options =>
{
    var fileProvider = new DbFileProvider(_serviceProvider.GetService<UIDbContext>());
    options.FileProviders.Add(fileProvider);
});

Is there any better way to be able to inject the UIDbContext into the DbFileProvider constructor Or any way to instantiate a UIDbContext inside DbFileProvider without IServiceProvider?

Im new to mvc approach im trying to use : https://www.aspsnippets.com/Articles/Save-MP3-Audio-Files-to-database-and-display-in-ASPNet-GridView-with-Play-and-Download-option.aspx

this snippet here in an mvc project. Ive tryed it on webforms and it works fine need some help converting it to mvc structure.

I am facing a situation where material detail can be entered manually or user can define a formula against each material category for a particular format description. Material has 5 properties itemType,Size,width,thickness,height, DIN, face, rate, degree etc. So each category can be configured so that a predefined description must come.

For example : If user want to a predefined description in "DN 1200 (NPS 48) WNRTJ-900# THK 32 SERIES A" format.

Then he must define a formula in a text box in syntax : "DN [Size]<4?'100':'1200' (NPS [SIZE]) [TYPE][FACE]-[RATE]# THK [thickness] [DIN]>0?' Series B':'Series A'"

Where [Size]=48 , [TYPE]=WN , [FACE]=RTJ, [Thickness]=32 and [DIN]=0

Please let me know if you have any suggestion.

Thanks in advance Minhaj

I want to get Excel file report from my data in asp.net mvc , but when I am in Local host and run from my codes it get me a file correctly and file Open right . but when I get codes in Server and I export Excel file ,after Download file , I click To Open , But It has Error that file format does not correct and does not open . I am very Confused . Please help me . my code :

public FileResult ExportOrders(string sortOrder, string title, string orderStatus
        , string sellerTrackCode, string paymentType, string settlementType, string sellerId, string excelDocumentId,
        string postmanId, string sellerCustomerName, string submittedDate, string fromSubmittedDate, string tillSubmittedDate,
        string fromDeliveredDate, string tillDeliveredDate, string fromPickUpDate, string tillPickUpDate, string fromId,
        string tillId, int? menuType, int? page, int? pageSize)
    {
        var query = _orderRepository.AsQueryable();
        var currentUser = User.Identity.GetUserName();

        if (currentUser != string.Empty)
        {
            var dbUser = _personRoleRepository.AsQueryable().FirstOrDefault(x => x.Person.UserName == currentUser);
            if (dbUser != null)
            {
                List<SellerCustomer> allSellerCustomers = new List<SellerCustomer>();
                var role = dbUser.Role;
                if (role.Title == "Seller")
                {
                    var seller = _sellerRepository.AsQueryable().First(x => x.PersonId == dbUser.PersonId);
                    query = query.Where(x => x.SellerId == seller.Id);
                }
            }
        }

        if (menuType == (int)MenuType.UnDoneOrders)
        {
            query = query.Where(x => x.OrderStatus == (byte)OrderStatus.Submitted || x.OrderStatus == (byte)OrderStatus.PayedByUser ||
                    x.OrderStatus == (byte)OrderStatus.TransmitToPort);
            ViewBag.menuType = MenuType.UnDoneOrders;
        }

        if (menuType == (int)MenuType.OpenOrders)
        {
            query = query.Where(x => x.OrderStatus == (byte)OrderStatus.WaitingForPostmanAssignment);
            ViewBag.menuType = MenuType.OpenOrders;
        }
        if (menuType == (int)MenuType.InProgressOrders)
        {
            query = query.Where(x => x.PostmanId != null && x.OrderStatus != (int)OrderStatus.DeliverToCustomer
                                                             && x.OrderStatus != (int)OrderStatus.ReturnedOrder);
            ViewBag.menuType = MenuType.InProgressOrders;
        }

        if (!String.IsNullOrEmpty(submittedDate))
        {
            DateTime date = CalendarHelper.GetGregorianDateTime(submittedDate);
            query = query.Where(s => s.SubmittedDate.Equals(date));
        }
        if (!String.IsNullOrEmpty(orderStatus))
        {
            var status = (byte)EnumsConverter.GetValueFromDescription<OrderStatus>(orderStatus);
            query = query.Where(s => s.OrderStatus.Equals(status));
        }
        if (!String.IsNullOrEmpty(title))
        {
            query = query.Where(s => s.Title.Contains(title));
        }
        if (!String.IsNullOrEmpty(sellerTrackCode))
        {
            query = query.Where(s => s.SellerTrackCode.Contains(sellerTrackCode));
        }
        if (!String.IsNullOrEmpty(paymentType))
        {
            var type = (byte)EnumsConverter.GetValueFromDescription<PaymentType>(paymentType);

            query = query.Where(s => s.PaymentType.Equals(type));
        }
        if (!String.IsNullOrEmpty(settlementType))
        {
            var settlement = (byte)EnumsConverter.GetValueFromDescription<SettlementType>(settlementType);
            query = query.Where(s => s.SettlementType.Equals(settlement));
        }
        if (!String.IsNullOrEmpty(sellerId))
        {
            var selId = Convert.ToInt32(sellerId);
            query = query.Where(s => s.SellerId == selId);
        }
        if (!String.IsNullOrEmpty(excelDocumentId))
        {
            var selId = Convert.ToInt32(excelDocumentId);
            query = query.Where(s => s.ExcelDocumentId == selId);
        }
        if (!String.IsNullOrEmpty(sellerCustomerName))
        {
            query = query.Where(s => s.SellerCustomerName.Contains(sellerCustomerName));
        }
        if (!String.IsNullOrEmpty(postmanId))
        {
            var selId = Convert.ToInt32(postmanId);
            query = query.Where(s => s.PostmanId == selId);
        }
        if (!String.IsNullOrEmpty(fromSubmittedDate))
        {
            var gregor = CalendarHelper.GetGregorianDate(fromSubmittedDate);
            query = query.Where(s => s.SubmittedDate >= gregor);
        }
        if (!String.IsNullOrEmpty(tillSubmittedDate))
        {
            var gregor = CalendarHelper.GetGregorianEndDate(tillSubmittedDate);
            query = query.Where(s => s.SubmittedDate <= gregor);
        }
        if (!String.IsNullOrEmpty(fromPickUpDate))
        {
            var gregor = CalendarHelper.GetGregorianDateTime(fromPickUpDate);
            query = query.Where(s => s.PickUpDate >= gregor);
        }
        if (!String.IsNullOrEmpty(tillPickUpDate))
        {
            var gregor = CalendarHelper.GetGregorianDateTime(tillPickUpDate);
            query = query.Where(s => s.PickUpDate <= gregor);
        }
        if (!String.IsNullOrEmpty(fromId))
        {
            var x = Convert.ToInt64(fromId);
            query = query.Where(s => s.Id >= x);
        }
        if (!String.IsNullOrEmpty(tillId))
        {
            var x = Convert.ToInt64(tillId);
            query = query.Where(s => s.Id <= x);
        }
        if (!String.IsNullOrEmpty(fromDeliveredDate))
        {
            var gregor = CalendarHelper.GetGregorianDate(fromDeliveredDate);
            query = query.Where(s => s.DeliveredDate >= gregor);
        }
        if (!String.IsNullOrEmpty(tillDeliveredDate))
        {
            var gregor = CalendarHelper.GetGregorianEndDate(tillDeliveredDate);
            query = query.Where(s => s.DeliveredDate <= gregor);
        }

        sortOrder = String.IsNullOrEmpty(sortOrder) ? SortKeys.PickupDateDesc : sortOrder;

        switch (sortOrder)
        {
            case SortKeys.SubmittedDate:
                query = query.OrderBy(x => x.SubmittedDate).ThenBy(x => x.Id);
                break;
            case SortKeys.SubmittedDateDesc:
                query = query.OrderByDescending(x => x.SubmittedDate).ThenBy(x => x.Id);
                break;
            case SortKeys.PickupDate:
                query = query.OrderBy(x => x.PickUpDate).ThenBy(x => x.Id);
                break;
            case SortKeys.PickupDateDesc:
                query = query.OrderByDescending(x => x.PickUpDate).ThenBy(x => x.Id);
                break;
            case SortKeys.OrderStatus:
                query = query.OrderBy(x => x.OrderStatus).ThenBy(x => x.Id);
                break;
            case SortKeys.OrderStatusDesc:
                query = query.OrderByDescending(x => x.OrderStatus).ThenBy(x => x.Id);
                break;
            case SortKeys.Title:
                query = query.OrderBy(x => x.Title).ThenBy(x => x.Id);
                break;
            case SortKeys.TitleDesc:
                query = query.OrderByDescending(x => x.Title).ThenBy(x => x.Id);
                break;
            case SortKeys.SellerTrackCode:
                query = query.OrderBy(x => x.SellerTrackCode).ThenBy(x => x.Id);
                break;
            case SortKeys.SellerTrackCodeDesc:
                query = query.OrderByDescending(x => x.SellerTrackCode).ThenBy(x => x.Id);
                break;
            case SortKeys.SellerId:
                query = query.OrderBy(x => x.Seller.StoreName).ThenBy(x => x.Id);
                break;
            case SortKeys.SellerIdDesc:
                query = query.OrderByDescending(x => x.Seller.StoreName).ThenBy(x => x.Id);
                break;
            case SortKeys.SellerCustomerName:
                query = query.OrderBy(x => x.SellerCustomerName).ThenBy(x => x.Id);
                break;
            case SortKeys.SellerCustomerNameDesc:
                query = query.OrderByDescending(x => x.SellerCustomerName).ThenBy(x => x.Id);
                break;
            case SortKeys.PostmanId:
                query = query.OrderBy(x => x.PostmanId).ThenBy(x => x.Id);
                break;
            case SortKeys.PostmanIdDesc:
                query = query.OrderByDescending(x => x.PostmanId).ThenBy(x => x.Id);
                break;
        }

        var orders = query.ToList();

        var path = Path.Combine(Server.MapPath("~/App_Data/"), "orderExcel.xlsx");

        if (orders.Count > 0)
        {
            using (var excelPackage = new ExcelPackage(new FileInfo(path)))
            {
                var ws = excelPackage.Workbook.Worksheets.FirstOrDefault(x => x.Name == "sheet1");
                if (ws != null)
                {
                    excelPackage.Workbook.Worksheets.Delete(ws);
                }
                excelPackage.Workbook.Worksheets.Add("sheet1");

                var workSheet = excelPackage.Workbook.Worksheets[1];
                workSheet.Cells.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
                workSheet.DefaultColWidth = 15;
                workSheet.Column(2).Width = 20;
                workSheet.Column(4).Width = 20;
                workSheet.Column(5).Width = 30;
                workSheet.Column(6).Width = 20;
                workSheet.Column(7).Width = 20;
                workSheet.Column(8).Width = 20;
                workSheet.Column(11).Width = 30;
                workSheet.Column(12).Width = 30;
                workSheet.Column(13).Width = 40;
                workSheet.Cells["I1:J1"].Merge = true;
                workSheet.View.RightToLeft = true;

                workSheet.Cells.Style.WrapText = true;

                workSheet.Cells[1, 9].Value = "هزینه های قابل پرداخت گیرنده";
                workSheet.Cells[2, 1].Value = "ردیف";
                workSheet.Cells[2, 2].Value = "شماره ارجاع";
                workSheet.Cells[2, 3].Value = "نوع مرسوله";
                workSheet.Cells[2, 4].Value = "نام گیرنده";
                workSheet.Cells[2, 5].Value = "آدرس گیرنده";
                workSheet.Cells[2, 6].Value = "شماره همراه گیرنده";
                workSheet.Cells[2, 7].Value = "تلفن گیرنده";
                workSheet.Cells[2, 8].Value = "تاریخ دریافت سفارش";
                workSheet.Cells[2, 9].Value = "وجه کالا";
                workSheet.Cells[2, 10].Value = "هزینه حمل";
                workSheet.Cells[2, 11].Value = "وضعیت سفارش";
                workSheet.Cells[2, 12].Value = "توضیحات";
                workSheet.Cells[2, 13].Value = "کد رهگیری";

                for (var index = 0; index < orders.Count; index++)
                {
                    var order = orders[index];
                    workSheet.Cells[index + 3, 1].Value = index + 1;
                    workSheet.Cells[index + 3, 2].Value = order.SellerTrackCode;
                    workSheet.Cells[index + 3, 3].Value = order.Title;
                    workSheet.Cells[index + 3, 4].Value = order.SellerCustomerName ?? string.Empty;
                    workSheet.Cells[index + 3, 5].Value = order.OrderAddress;
                    workSheet.Cells[index + 3, 6].Value = order.Mobile;
                    workSheet.Cells[index + 3, 7].Value = order.Tel;
                    workSheet.Cells[index + 3, 8].Value = order.PickUpDate.GetPersianDate();
                    workSheet.Cells[index + 3, 9].Value = order.OrderValue;
                    workSheet.Cells[index + 3, 10].Value = order.DeliveryCost;
                    workSheet.Cells[index + 3, 11].Value = EnumsConverter.GetDescriptionFromValue((OrderStatus)order.OrderStatus);
                    workSheet.Cells[index + 3, 12].Value = order.Description;
                    workSheet.Cells[index + 3, 13].Value = order.Id;
                }
                excelPackage.Save();
            }
        }
        byte[] fileBytes = System.IO.File.ReadAllBytes(path);
        string fileName = "orderExcel.xlsx";
        return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
    }
}

Im a beginner in sql query and I would like to ask 1 question.

I have 2 table which is dbo.Group_Master and dbo.Group_Assign. When I joined both table and put where clause, and run query like below

Select a.GROUP_ID,a.GROUP_DESC, CASE WHEN b.GROUP_ID IS NULL THEN '0' ELSE '1' end as status from dbo.GROUP_MASTER A INNER JOIN dbo.GROUP_ASSIGN B ON B.GROUP_ID = a.GROUP_ID WHERE B.LOG_NAME LIKE 'ACCOUNT'

It display result like this :

What I want is the result manage to display all the first 2 column and only third column is affected like below image. Is there any way i can do it ?

Expected Output

I am getting the following error when i click on login button :

There is no row at position 0.

specifically at the Image3.ImageUrl = HDT.Rows[0]["image"].ToString(); line. There is an image in the database and is not null.

Here is the code of the block where i am getting error

protected void Page_Load(object sender, EventArgs e)
{
    lblsell.Text = "";
    UDT = UAdapter.Select_By_UID(Convert.ToInt32(Session["uid"].ToString()));
    HDT = HAdapter.Select_By_SNAME_BLOCKNO(UDT.Rows[0]["societyname"].ToString(), Convert.ToInt32(UDT.Rows[0]["Houseid"].ToString()));

    Image3.ImageUrl = HDT.Rows[0]["image"].ToString();
    lblsname.Text = HDT.Rows[0]["sname"].ToString();
    lblbno.Text = HDT.Rows[0]["blockno"].ToString();
    lbltype.Text = HDT.Rows[0]["type"].ToString();
    ViewState["HID"] = HDT.Rows[0]["HID"].ToString();

}

Multiple Asp.Net Framework 4.6.2 MVC/Razor projects within a single solution. They use Areas, and each project will implement one or more Areas, distinct from the other. One project acts as the "primary", and includes the global.asax. The "subordinate" apps can know about the "primary", but not vice versa.

Is it possible to deploy these to the same web site? (on-prem VM). There would be some collisions, such as the _Layout.cshtml.

Some how I'd have to be able to setup dependency injections for the classes in the "subordinate" project assembly.

Thanks

-John

Application : Asp.net with static web methods declared on page migrated to asp.net web forms with static web methods converted to web API 2 controllers and secured using JWT tokens. Currently web API controller instantiation is done by AutoFac

 builder.RegisterType<Controller>().As<IController>().InstancePerRequest();

Calling Code : Javascript using async AJAX

Problem : Whenever more than 3-4 calls come for same web API in one second, requests are struck in IIS queue and take couple of minutes to ease off. This causes major issue to end users. Following is the data extracted from IIS logs.

Analysis : Its very hard for me to believe that Autofac is unable to create multiple instances per second of a controller. Web API is a very mature framework and there is a very little overhead in object instantiation. In earlier implementation static webmethods were shared with everyone so there was no instantiation overhead however with WebAPI there is a controller instantiation overhead which as per me AutoFac is unable to spin out instances in a second. I can change InstancePerRequest to Application scope but considering the problem is happening in production, it will be risky.

Has someone faced such issues and any help that i can get from the vast experience that exists on SO. Also is this the right direction to analyse?

I am planning to get a DebugDiag hang analysis done to confirm this.

enter image description here