有段asp代码!!
<%
dim ComeUrl,cUrl,AdminNameComeUrl=lcase(trim(request.ServerVariables("HTTP_REFERER")))
if ComeUrl="" then
response.write "<br><p align=center><font color='red'>对不起,为了系统安全,不允许直接输入地址访问本系统的后台管理页面。</font></p>"
response.end
else
cUrl=trim("http://" & Request.ServerVariables("SERVER_NAME"))
if mid(ComeUrl,len(cUrl)+1,1)=":" then
cUrl=cUrl & ":" & Request.ServerVariables("SERVER_PORT")
end if
cUrl=lcase(cUrl & request.ServerVariables("SCRIPT_NAME"))
if lcase(left(ComeUrl,instrrev(ComeUrl,"/")))<>lcase(left(cUrl,instrrev(cUrl,"/"))) then
response.write "<br><p align=center><font color='red'>对不起,为了系统安全,不允许从外部链接地址访问本系统的后台管理页面。</font></p>"
response.end
end if
end if
%>
请问 怎么用C#来实现!!!

解决方案 »

  1.   

    把改成C#的語法就可以了﹗
    if ..then
    else
     end if
    ------------if 
                  {}
                else
                  {}
    還有每句的后面要加";"
      

  2.   

    这个不需要高手来,只是体力活,没人愿意做.没有技术含量.问题是你是asp不会还是C#不会?
      

  3.   

    string ComeUrl,cUrl,AdminName;public void check()
    {
      ComeUrl=request.ServerVariables("HTTP_REFERER").ToString().Trim();
      if(ComeUrl=="")
      {
         Response.Write("对不起,为了系统安全,不允许直接输入地址访问本系统的后台管理页面。");
        ... ...
      }
      else
      {
        ... ...
      }
      

  4.   

    是不会  asp  关键 是这句 if mid(ComeUrl,len(cUrl)+1,1)=":" then
    cUrl=cUrl & ":" & Request.ServerVariables("SERVER_PORT")
    end if
    cUrl=lcase(cUrl & request.ServerVariables("SCRIPT_NAME"))
    if lcase(left(ComeUrl,instrrev(ComeUrl,"/")))<>lcase(left(cUrl,instrrev(cUrl,"/"))) then
    不会转啊 其他的都好办
      

  5.   

    看来asp和C#两种语言都会的人很少!!!没办法了!!还是的靠自己了