c#

GetBinaryType() returns the bitness to match the calling app

我们两清 提交于 2021-02-20 05:06:41
问题 I am using this to determine if Office is 32-bit or 64-bit. I am calling it from a C# app. GetBinaryType(location, out bt) The exact same code, calling this on winword.exe, returns either 32-bit or 64-bit, matching the bitness of my C# app. Is there something I need to do when running in 64-bit mode that it still returns 32-bit for Office? I've put a very simple sample program here. The output running in x86 mode (on 64-bit Windows is): Running in 32-bit mode. GetBinaryType() returns SCS

IdentityServer4 LocalApi with custom policy in .NET Core 3.1

两盒软妹~` 提交于 2021-02-20 05:06:14
问题 I'm trying to use the "LocalApi" feature of IdentityServer4 with some custom Policies. I have an API (hosted on the same application instance as IdentityServer4) that is divided into three parts (Server, Manager, Product) and for three clients (Server, Manager, Product). Client can only call the devoted part of the API and I would do this with Policies based on scopes. So I have the following: Starup: services.AddLocalApiAuthentication(); // Add API hosted on same application than

Error in C# application . System.ArgumentException: The path is not of a legal form?

偶尔善良 提交于 2021-02-20 05:01:09
问题 I am not getting why this error is coming i serach in net and not able to get answer . Technologies using : C# Visual Studio for debugging the project I have a code private void InitializeWatcher(string sourceDirectoryPath, string watcherFilter, bool isWatcherIncludeSubdirectories) { objWatcher = new FileSystemWatcher(); objWatcher.IncludeSubdirectories =isWatcherIncludeSubdirectories; objWatcher.InternalBufferSize = 16384; if (Utilities.LogLevel >= Utilities.Informational) { Utilities

10 check-boxes multiple combinations in c#

扶醉桌前 提交于 2021-02-20 04:56:46
问题 How do I loop through without writing a million if statements? Here's a sample of the code I have it wrong as it will only check each box and then move on to the next. Forgot to say that all ten check boxes are in a panel and they need to be check in any combination. I don't want to write heaps of && or || I cant even count the combinations Please help me. if (cbxTitle.Checked == true) { searched = "title"; } else if (cbxAuthor.Checked == true) { searched = "author"; } else if (cbxYear

Session ID changes in each Request

大憨熊 提交于 2021-02-20 04:55:40
问题 I have an asp.net application in which i redirect from one page to another. I'm validating the SessionID in the second page to make sure both requests are of the same session. Now, my problem is the SessionID changes whenever a Postback is happened. Now, I added the Session tag into my web.config <sessionState mode="InProc" cookieless="true"/> Now, the problem with the session was solved and a new issue started appearing. Whenever i make a call with Cookiless="true" in my web.config file, my

Send mail using default webclient in ASP.NET using MAPI in C# web application

醉酒当歌 提交于 2021-02-20 04:50:29
问题 I am using MAPI for opening default web mail client in my C# web application. Now it is opening as dialog box first then outlook window. I want to open direct default mail client window using MAPI. But when I am deploying on IIS then MAPI is not calling Mail Dialog box. Is there simple way of calling web mail client using MAPI with attachment? 回答1: Don't use the MAPI. Use System.Net.Mail: http://www.systemnetmail.com/faq/3.4.1.aspx static void AttachmentFromFile() { //create the mail message

Entity Framework and ASP.NET MVC 5 How can I push selected checkoxes into my localDB?

一曲冷凌霜 提交于 2021-02-20 04:45:25
问题 I am having troubles with pushing selected checkboxes into the table. I have three tables - Employees , Projects and EmployeeProject . For one Employee I want to be able to choose multiple projects. I already created a create view with inputs for name of the employee and checkboxes of the projects. How can I send data to the EmployeeProjects table? So I could display it later. My models: public class Employee { [Key] public int Id { get; set; } public string FirstName { get; set; } public

Entity Framework and ASP.NET MVC 5 How can I push selected checkoxes into my localDB?

只愿长相守 提交于 2021-02-20 04:45:06
问题 I am having troubles with pushing selected checkboxes into the table. I have three tables - Employees , Projects and EmployeeProject . For one Employee I want to be able to choose multiple projects. I already created a create view with inputs for name of the employee and checkboxes of the projects. How can I send data to the EmployeeProjects table? So I could display it later. My models: public class Employee { [Key] public int Id { get; set; } public string FirstName { get; set; } public

Dynamic routing handling in web config

两盒软妹~` 提交于 2021-02-20 04:45:05
问题 I have built up a project and deployed it in iis server and the web.config file looks like, <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="about" stopProcessing="true"> <match url="^about$" /> <action type="Rewrite" url="/about.html" /> </rule> <rule name="contact" stopProcessing="true"> <match url="^contact$" /> <action type="Rewrite" url="/contact.html" /> </rule> </rules> </rewrite> </system.webServer> </configuration> Folder

How to change exe icon programmatically in c# net [duplicate]

我的梦境 提交于 2021-02-20 04:39:10
问题 This question already has answers here : Changing external exe icon at runtime (2 answers) Closed 4 years ago . I have multiple products, for each product we have different .Icon, We need to change the exe icon programmatically, So it that user can see different exe icon for each product. 回答1: Perhaps you can have a different publish profile for the different products? You could also add all the icons to the project at once and change them on the shortcuts. 来源: https://stackoverflow.com