Hi
I'm new with C# and I want to convert this vb.net code to C# but i get two errors like "a namespace doesn't not contain members ..." on the line "Public Class check" and "expected classes ..." on the line "Public Shared"
Thanks for help.
Here the vb.net code:
- Imports Microsoft.VisualBasic
- Public Class check
- Public Shared Sub ok()
- Dim ok As HttpCookie
- ok = HttpContext.Current.Request.Cookies("ok")
- Try
- If Not ok.Value = "y" Then
- End If
- Catch ex As Exception
- Dim jv As String
- jv = ""
- HttpContext.Current.Response.Write(jv)
- End Try
- End Sub
- End Class
And here my C# code:
- using System;
- using System.Web.UI.WebControls;
- Public Class check
- {
- public static void ok()
- {
- HttpCookie ok;
- ok = HttpContext.Current.Request.Cookies("ok");
- try
- {
- if (!(ok.Value == "y"))
- {}
- }
- catch (Exception ex)
- {
- string jv;
- jv = "";
- HttpContext.Current.Response.Write(jv);
- }
- }
- }

Rijwan AnsariRank #82 · 24.2K reputationPosted Apr 13, 2021, 12:23 AM EDT
Satya KarkiRank #78 · 24.6K reputationPosted Apr 13, 2021, 12:46 AM EDT
raf maester5 reputationPosted Apr 13, 2021, 4:56 AM EDT