⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaultvb.aspx.vb

📁 Telerik是很大的第三方软件制造商
💻 VB
字号:

Imports System
Imports System.Threading
Imports System.Web.Security
Imports System.Web.UI.WebControls


Namespace Telerik.EditorExamplesVBNET.Editor.Examples.Security
   
   '/ <summary>
   '/ Summary description for DefaultCS.
   '/ </summary>
   Public Class DefaultVB
      Inherits Telerik.QuickStart.XhtmlPage
      Protected editor1 As Telerik.WebControls.RadEditor
      Protected btnLogout As System.Web.UI.WebControls.LinkButton
      Protected infoLabel As Label
      
      
      Private Sub Page_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load
         If Not Thread.CurrentPrincipal.Identity.IsAuthenticated Then
            Response.Redirect((Me.TemplateSourceDirectory + "/LoginCS.aspx"))
         End If
         
         infoLabel.Text = "<span style='color: red'>You are logged in as: <b>" + Thread.CurrentPrincipal.Identity.Name + "</b></span>"
         
         If Thread.CurrentPrincipal.Identity.Name = "superadmin" Then
            editor1.HasPermission = True
            editor1.Editable = True
            editor1.Html = "This text will be seen by superadmin users."
            ' IMPORTANT !!!! - API for FAST CUSTOMIZATION OF USER DIRECTORIES
            Dim dirs() As String = {"~/Editor/Img"}
            editor1.SetPaths(dirs, Telerik.WebControls.EditorFileTypes.All, Telerik.WebControls.EditorFileOptions.All)
         'Telerik.WebControls.EditorFileTypes.Documents | 
         'Telerik.WebControls.EditorFileTypes.Images |
         'Telerik.WebControls.EditorFileTypes.Flash |
         'Telerik.WebControls.EditorFileTypes.Media
         'Telerik.WebControls.EditorFileOptions.Browse |
         'Telerik.WebControls.EditorFileOptions.Upload |
         'Telerik.WebControls.EditorFileOptions.Delete
         ElseIf Thread.CurrentPrincipal.Identity.Name = "admin" Then
            editor1.HasPermission = True
            editor1.Editable = True
            
            ' Other editor properties can be changed here - security policies can be very fine-grained, e.g.
            editor1.Html = "This text will be seen by admin users."
            
            ' IMPORTANT !!!! - API for FAST CUSTOMIZATION OF USER DIRECTORIES
            Dim dirs() As String = {"~/Editor/Img"}
            editor1.SetPaths(dirs, Telerik.WebControls.EditorFileTypes.All, Telerik.WebControls.EditorFileOptions.All)
         'Telerik.WebControls.EditorFileTypes.Documents | 
         'Telerik.WebControls.EditorFileTypes.Images |
         'Telerik.WebControls.EditorFileTypes.Flash |
         'Telerik.WebControls.EditorFileTypes.Media
         'Telerik.WebControls.EditorFileOptions.Browse |
         'Telerik.WebControls.EditorFileOptions.Upload |
         'Telerik.WebControls.EditorFileOptions.Delete
         Else
            infoLabel.Text = "<span style='color: red'>Your session has probably expired</span>"
            editor1.Html = "You must log-in as admin or superadmin to edit this content."
            editor1.HasPermission = False
            editor1.Editable = True
         End If
      End Sub 'Page_Load
      
      
      Protected Sub btnLogout_Click(sender As Object, e As System.EventArgs)
         FormsAuthentication.SignOut()
         Response.Redirect((Me.TemplateSourceDirectory + "/LoginCS.aspx"))
      End Sub 'btnLogout_Click
      Protected Overrides Sub OnInit(e As EventArgs)
         '
         ' CODEGEN: This call is required by the ASP.NET Web Form Designer.
         '
         InitializeComponent()
         MyBase.OnInit(e)
      End Sub 'OnInit
      
      
      '/ <summary>
      '/ Required method for Designer support - do not modify
      '/ the contents of this method with the code editor.
      '/ </summary>
      Private Sub InitializeComponent()
      End Sub 'InitializeComponent
   End Class 'DefaultVB
End Namespace 'Telerik.EditorExamplesVBNET.Editor.Examples.Security

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -