开发者

ASP.NET MVC get header

开发者 https://www.devze.com 2023-03-22 07:26 出处:网络
What is the most efficient way to get header开发者_开发问答s in ASP.NET MVC basically, I am trying this approach to validate youtube url:Check if Youtube and Vimeo-clips are valid

What is the most efficient way to get header开发者_开发问答s in ASP.NET MVC

basically, I am trying this approach to validate youtube url: Check if Youtube and Vimeo-clips are valid

Basically, the link talks about using get_headers in PHP to validate youtube url.

the only problem is I am using C#.NET (ASP.NET MVC) not PHP.

How should I efficiently get header?


I'm assuming you want to do this server-side and would use an HttpWebRequest. The accepted answer on Why Does my HttpWebRequest Return 400 Bad request? should get you started. Essentially, what you'll want to do is verify that the request succeeds and check the relevant headers. If you only want the headers, set the method to HEAD instead of GET.

0

精彩评论

暂无评论...
验证码 换一张
取 消