VB.net的EnableCors [英] EnableCors for VB.net

查看:26
本文介绍了VB.net的EnableCors的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何将 enableCors 放入 vb.net 上的控制器中.我正在与一个复数课程一起工作,并尝试了一个没有运气的代码翻译器.我的尝试如下.

Does anyone know how to put the enableCors into the controller on vb.net. i am working along with a pluralsight course and tried a code translator with no luck. my attempt is below.

<EnableCors(origins:    "http://localhost:53080", headers: "*", methods: "*")>

推荐答案

正确的语法应该是这样的:

The correct syntax would be something like this:

<EnableCors("http://localhost:53080", "*","*")>

C# 示例似乎使用命名参数.VB.NET 也支持这一点,但是 EnableCorsAttributes 具有仅因字母大小写不同而不同的属性和承包商参数.这会混淆编译器是否尝试设置命名参数或属性中的属性.所以,在这种情况下,我们可以一起删除命名参数.

The C# example appears to use named parameters. VB.NET supports that too, however the EnableCorsAttributes has properties and contractor arguments that only differ by letter casing. This confuses the compiler as to whether you are attempting to set the named parameter or the property in the attribute. So, in this case we can just drop the named arguments all together.

这篇关于VB.net的EnableCors的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆