ASP.NET

Redirect outside of the Controllers context in ASP.NET Core

做~自己de王妃 提交于 2021-02-19 16:43:30
问题 I do not know if this is actually possible, but I think it' s worth a try to find out. There are maybe other and better patterns (if you know one let me know, I will look them up) to do this, but I'm just curious to know if this is possible. When you have to call an API you could do it directly from within the controller using the HttpClient like this: [Authorize] public async Task<IActionResult> Private() { //Example: get some access token to use in api call var accessToken = await

TFS 2017- Release deploy app to IIS under a website

谁说我不能喝 提交于 2021-02-19 16:00:58
问题 I am using TFS 2017 build and realease to deploy a website, In my IIS i have the following Structure - WebsiteHost - ApplicationToDeploy I am using Deploy IIS App step on TFS realease definition Question : how can I tell the realease build to update ApplicationToDeploy under WebsiteHost ? Right now it creates a new Website on WebsiteHost level which i don't want. I tried WebsiteHost\ApplicationToDeploy in Host name field in the task but that just created a website with Host name WebsiteHost

TFS 2017- Release deploy app to IIS under a website

喜夏-厌秋 提交于 2021-02-19 16:00:52
问题 I am using TFS 2017 build and realease to deploy a website, In my IIS i have the following Structure - WebsiteHost - ApplicationToDeploy I am using Deploy IIS App step on TFS realease definition Question : how can I tell the realease build to update ApplicationToDeploy under WebsiteHost ? Right now it creates a new Website on WebsiteHost level which i don't want. I tried WebsiteHost\ApplicationToDeploy in Host name field in the task but that just created a website with Host name WebsiteHost

TFS 2017- Release deploy app to IIS under a website

倾然丶 夕夏残阳落幕 提交于 2021-02-19 16:00:15
问题 I am using TFS 2017 build and realease to deploy a website, In my IIS i have the following Structure - WebsiteHost - ApplicationToDeploy I am using Deploy IIS App step on TFS realease definition Question : how can I tell the realease build to update ApplicationToDeploy under WebsiteHost ? Right now it creates a new Website on WebsiteHost level which i don't want. I tried WebsiteHost\ApplicationToDeploy in Host name field in the task but that just created a website with Host name WebsiteHost

Set docx properties using library .docx

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-19 15:48:21
问题 How to set properties like title, author, subject for a file created with docx library for .net ? docx 回答1: The DocX project that you provided appears to be able to easily access the metadata properties that you are referring to and can do so quite easily by using the CoreProperties property as seen below : // Load your Document var wordFile = Novacode.DocX.Load(@"your-docx-file-path"); // Access Metadata properties var props = wordFile.CoreProperties; The issue here is that this collection

Blazor select bind to a value in a list [duplicate]

半腔热情 提交于 2021-02-19 08:43:10
问题 This question already has answers here : blazor variable argument passing to onclick function (2 answers) Closed last year . I was able to bind an int type (which is the first element of the list SelectedDiagnosisIdList) variable to the selected element of a html select: <div> <label>Diagnosis:</label> <div> <select @bind="@userInfo.SelectedDiagnosisIdList[0]"> @foreach (var item in diagnoses) { <option value="@item.Id">@item.Name</option> } </select> <p>@userInfo.SelectedDiagnosisIdList[0]"<

Convert Soap XML to a Json Object in C#

我的梦境 提交于 2021-02-19 08:39:31
问题 Background Information I have two .net services (say A and B). Service B uses a service reference of Service A. Here, 'basicHttpBinding' is being used. There is a global.asax.cs present in Service A where I plan to perform some operations before the call is sent to Service A.svc.cs I'm able to read request body in global.asax.cs using the following code. StreamReader streamReader = new StreamReader(HttpContext.Current.Request.InputStream); streamReader.BaseStream.Position = 0; string message

自建Socket转发,使用远程桌面(mstsc)连接家中电脑

折月煮酒 提交于 2021-02-19 08:07:10
原文: 自建Socket转发,使用远程桌面(mstsc)连接家中电脑 网络结构图如下: 开题先放图,一切全靠编哈哈。 进入正题! 如图所示,我们需要一个公网服务器,利用公网服务器将内网的数据进行转发,从而实现两个内网服务器的通讯。没错,这不是p2p,原本想做成p2p,因为有点难度,所以先弄一个tcp数据包转发,后面再来打洞进行p2p连接。 开发环境 VS2017 + asp net core2.1 + .net framework 4.5 整个过程是如何实现的呢? 1.被控客户端启动,发送被控端名称,例如:Home 2.服务器接收到被控端的数据,将Home记录,并将Home绑定到当前Tcp连接 3.主控端启动,发送要连接的“被控端服务”名称,例如:Home 4.服务端接收到主控端的请求,查询Home对应的Tcp连接 5.将从主控端来的数据转发到被控端,将被控端来的数据转发到主控端 代码在哪? 放到github上了: https://github.com/bobowire/Wireboy.Socket.P2PService 在实现的过程中遇到什么问题了? 1.由于windows锁屏后,Console.WriteLine方法会进行无限期等待,导致程序卡住不动。 解决办法:在运行后,将所有的Console.WriteLine方法全部注释掉了。 2.在连接一次之后

自建Socket转发,使用远程桌面(mstsc)连接家中电脑

蹲街弑〆低调 提交于 2021-02-19 08:06:58
网络结构图如下: 开题先放图,一切全靠编哈哈。 进入正题! 如图所示,我们需要一个公网服务器,利用公网服务器将内网的数据进行转发,从而实现两个内网服务器的通讯。没错,这不是p2p,原本想做成p2p,因为有点难度,所以先弄一个tcp数据包转发,后面再来打洞进行p2p连接。 开发环境 VS2017 + asp net core2.1 + .net framework 4.5 整个过程是如何实现的呢? 1.被控客户端启动,发送被控端名称,例如:Home 2.服务器接收到被控端的数据,将Home记录,并将Home绑定到当前Tcp连接 3.主控端启动,发送要连接的“被控端服务”名称,例如:Home 4.服务端接收到主控端的请求,查询Home对应的Tcp连接 5.将从主控端来的数据转发到被控端,将被控端来的数据转发到主控端 代码在哪? 放到github上了: https://github.com/bobowire/Wireboy.Socket.P2PService 在实现的过程中遇到什么问题了? 1.由于windows锁屏后,Console.WriteLine方法会进行无限期等待,导致程序卡住不动。 解决办法:在运行后,将所有的Console.WriteLine方法全部注释掉了。 2.在连接一次之后,再次连接会因为接收函数的超时时间太长,导致后面连接失败 解决办法:增加守护线程

Resource based ASP.NET Authorization FormsAuthentication and WebApi

烂漫一生 提交于 2021-02-19 08:01:28
问题 Using webapi with formsauthentication (i know may sound weird, but it exactly what I need). I have a route like : [Route("{application}/orders}"] public IHttpActionResult Get(string application) { var orders = OrderService.GetOrders(application); // return list of orders of applicaiton. return Ok(orders); } Example scenario : User John has permission to see orders for application "CoolApp" User Leia has permission to see orders for application "Robin" user Tristan doesn't have permission to