asp.net-mvc

Can't access to network share from application

让人想犯罪 __ 提交于 2021-02-15 07:42:44
问题 I'm having problem with accessing to network share from my MVC application. Application is hosted on IIS installed on remote machine named INTRANET, which is connected to same domain. Website is using Application pool which is configured for Network Service . There are anonymous and windows authentication enabled. When I'm debugging application locally (IIS Express and Visual Studio is opened as administrator) there is no problem. I can access to network share and download file. The problem

Cross Join in Entity framework Lambda Expressions

半城伤御伤魂 提交于 2021-02-15 06:58:02
问题 How can I do the following join in EF? Tables have no relation with each other, no foreign keys. Select t1.ID, t1.firstname, t2.ID,t2.name from MY_TEST_TABLE1 t1, MY_TEST_TABLE2 t2 where t1.firstname = t2.name 回答1: You could do this: var query= from t1 in context.MY_TEST_TABLE1 from t2 in context.MY_TEST_TABLE2 where t1.firstname == t2.name select new { Table1Id= t1.ID, FirstName= t1.firstname, Table2Id=t2.ID,Name= t2.name}; Another way to do a cross join in Linq to Entities is using

How to integrate stripe payment with custom form in ASP.NET MVC? [closed]

感情迁移 提交于 2021-02-13 11:53:25
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last month . Improve this question How do I use custom stripe form and then integration with 3D Security options using ASP.NET MVC? 回答1: Custom Form Design using Razor/ Html <div class="campagin_start content" style="max-width:100%"> <div class="cell example example2" id=""> <form> <div class=

Windows Authentication not working in existing asp.net site

佐手、 提交于 2021-02-11 18:16:05
问题 I have an existing asp.net site that I want to modify to use Windows authentication (It is on a local intranet.) I have modified the web.config file to use Windows Auth: <configuration> <system.web> <authentication mode="Windows"/> <authorization> <deny users="?"/> </authorization> <compilation debug="true"/> </system.web> The error message that I get is: 401.2.: Unauthorized: Logon failed due to server configuration. If I remove: <deny users="?"/> Then the page is shown. However this code

Windows Authentication not working in existing asp.net site

扶醉桌前 提交于 2021-02-11 18:06:28
问题 I have an existing asp.net site that I want to modify to use Windows authentication (It is on a local intranet.) I have modified the web.config file to use Windows Auth: <configuration> <system.web> <authentication mode="Windows"/> <authorization> <deny users="?"/> </authorization> <compilation debug="true"/> </system.web> The error message that I get is: 401.2.: Unauthorized: Logon failed due to server configuration. If I remove: <deny users="?"/> Then the page is shown. However this code

Encrypting image data before uploading to azure blob storage

放肆的年华 提交于 2021-02-11 17:45:30
问题 I have the following code that uploads an image to Azure blob storage. I would like to encrypt the image data before uploading to the blob. I already have a helper class for encrypting and decrypting that I can use by calling AESEncryption.Encrypt("plainText", "key", salt"); I'm just trying to figure out how tom integrate my encryption method into the code. Also, I'm guessing that once it's encrypted instead of calling blob.UploadFromFile() I will be calling blob.UploadFromByteArray(). public

How to implement role authorization with custom database?

試著忘記壹切 提交于 2021-02-11 17:44:49
问题 I have an application which requires role authorization using custom database. The database is set up with a tblUsers table that has a reference to a tblRoles table. The users are also already assigned to their roles. I also want to use the [Authorize(Role = "RoleName")] attribute on each action to check if an authenticated user is assigned to "RoleName" in the database. I'm having a lot of trouble figuring out where I need to make a modification to the [Authorize] attribute so it behaves

DropDownList containing weeks

我怕爱的太早我们不能终老 提交于 2021-02-11 17:29:47
问题 I'm working on an intranet site, specifically on a Weekly Monitoring tool for employees. What I need is to fill a DropDownList with weeks, example week: Week : From 12/10/15 to 18/10/15 I'm able to filter on another page but with years and month: CalendarController c = new CalendarController(); ViewBag.ListYears = c.ListYears(iyear); ViewBag.ListMonths = c.ListMonths(imonth); ViewBag.ListDaysOfMonth = _service.ListDaysOfMonth(iyear.ToString(), imonth.ToString()); And use forms to save them.

DateTime format debugging

对着背影说爱祢 提交于 2021-02-11 15:55:53
问题 So I have been struggling with DateTime formats. I am making an ASP.NET MVC app and I have a DateOfBooking property which is DateTime type. This property books DateTime.Date.Now when the form is sent. Below is my property and DataAnotations used to format my date. Format which i need is dd/MM/yyyy, but my column in DB (MS SQL Server Managment Studio) is in format yyyy-MM-dd. [DataType(DataType.Date)] [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)] public

Is it possible to get template from different directory?

送分小仙女□ 提交于 2021-02-11 15:15:51
问题 I'm using the same cshtml files in different projects so I would like to be able to share the same directory, the 'GeneralTemplates'. So using the @Html.Partial("GeneralTemplates/_Header") works like a charm. But with @Html.MvcSiteMap().SiteMapPath("GeneralTemplates/_Breadcrumbs") is doesn't work, this needs to be in the 'DisplayTemplates' directory and then this works @Html.MvcSiteMap().SiteMapPath("_Breadcrumbs") . Does anyone has an solution for me to be able to have the file in the