• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Security.PortalSecurity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DotNetNuke.Security.PortalSecurity的典型用法代码示例。如果您正苦于以下问题:C# PortalSecurity类的具体用法?C# PortalSecurity怎么用?C# PortalSecurity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PortalSecurity类属于DotNetNuke.Security命名空间,在下文中一共展示了PortalSecurity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RenderAttributes

        protected override void RenderAttributes(HtmlTextWriter writer)
        {
            StringWriter stringWriter = new StringWriter();
            HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
            base.RenderAttributes(htmlWriter);
            string html = stringWriter.ToString();

            // Locate and replace action attribute
            int startPoint = html.IndexOf("action=\"");
            if (startPoint >= 0) //does action exist?
            {
                int endPoint = html.IndexOf("\"", startPoint + 8) + 1;
                html = html.Remove(startPoint, endPoint - startPoint);
                PortalSecurity objSecurity = new PortalSecurity();
                html = html.Insert(startPoint, "action=\"" + objSecurity.InputFilter(HttpContext.Current.Request.RawUrl, PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoAngleBrackets | PortalSecurity.FilterFlag.NoMarkup) + "\"");
            }

            //' Locate and replace id attribute
            if (base.ID != null)
            {
                startPoint = html.IndexOf("id=\"");
                if (startPoint >= 0) //does id exist?
                {
                    int EndPoint = html.IndexOf("\"", startPoint + 4) + 1;
                    html = html.Remove(startPoint, EndPoint - startPoint);
                    html = html.Insert(startPoint, "id=\"" + base.ClientID + "\"");
                }
            }

            writer.Write(html);
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:31,代码来源:Form.cs


示例2: GetFilteredValue

 private static string GetFilteredValue(PortalSecurity objSecurity, string value)
 {
     return objSecurity.InputFilter(
         value,
         PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoAngleBrackets
         | PortalSecurity.FilterFlag.NoMarkup);
 }
开发者ID:shahinhemati,项目名称:project-example-a,代码行数:7,代码来源:QAServiceController.cs


示例3: linksignout_Click

 protected void linksignout_Click(object sender, EventArgs e)
 {
     DotNetNuke.Security.PortalSecurity signout = new DotNetNuke.Security.PortalSecurity();
     signout.SignOut();
     string currentpage = Page.Request.Url.AbsoluteUri.ToString();
     Response.Redirect(currentpage.ToString());
 }
开发者ID:goedings,项目名称:VendorLink,代码行数:7,代码来源:login.ascx.cs


示例4: BecomeUser

        public string BecomeUser(int userToBecomeId, int currentlyLoggedInUser, HttpContext context, PortalSettings portalSettings, HttpSessionState sessionState)
        {
            string url = string.Empty;
            string sessionStateName = string.Empty;
            if (Settings[ModuleSettingsNames.SessionObject] != null)
                sessionStateName = Settings[ModuleSettingsNames.SessionObject].ToString();
            if (userToBecomeId > 0)
            {
                DataCache.ClearUserCache(portalSettings.PortalId, context.User.Identity.Name);
                PortalSecurity portalSecurity = new PortalSecurity();
                portalSecurity.SignOut();

                UserInfo newUserInfo = UserController.GetUserById(portalSettings.PortalId, userToBecomeId);

                if (newUserInfo != null)
                {
                    sessionState.Contents[sessionStateName] = null;
                    UserController.UserLogin(portalSettings.PortalId, newUserInfo, portalSettings.PortalName, HttpContext.Current.Request.UserHostAddress, false);

                    if (currentlyLoggedInUser != 0)
                    {
                        sessionState[sessionStateName] = currentlyLoggedInUser;
                    }
                    else
                    {
                        sessionState[sessionStateName] = null;
                    }
                    url = (context.Request.UrlReferrer.AbsoluteUri);
                }
            }

            return url;
        }
开发者ID:GravityWorks-Scott,项目名称:GravityWorks.DNN.BecomeUser,代码行数:33,代码来源:Default.ascx.cs


示例5: DecryptParameter

 public static string DecryptParameter( string Value )
 {
     PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings();
     string strKey = _portalSettings.GUID.ToString(); // restrict the key to 6 characters to conserve space
     PortalSecurity objSecurity = new PortalSecurity();
     return objSecurity.Decrypt( strKey, Value );
 }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:7,代码来源:UrlUtils.cs


示例6: OnSaveClick

 private void OnSaveClick(object sender, EventArgs e)
 {
     PortalSecurity ps = new PortalSecurity();
     PortalController.UpdatePortalSetting(PortalId, "Store_Username", ps.EncryptString(txtUsername.Text, Config.GetDecryptionkey()));
     PortalController.UpdatePortalSetting(PortalId, "Store_Password", ps.EncryptString(txtPassword.Text, Config.GetDecryptionkey()));
     Response.Redirect(Globals.NavigateURL());
 }
开发者ID:hackoose,项目名称:cfi-team05,代码行数:7,代码来源:Store.ascx.cs


示例7: linklogin_Click

 protected void linklogin_Click(object sender, EventArgs e)
 {
     DotNetNuke.Security.PortalSecurity users = new DotNetNuke.Security.PortalSecurity();
     string username = txtusername.Text.ToString();
     string password = txtpassword.Text.ToString();
     string portalname = PortalSettings.PortalName.ToString();
     int pid = PortalId;
     int userfound;
      userfound = users.UserLogin(username.ToString(), password.ToString(), pid, portalname, "127.0.0.1", true);
      if (userfound == -1)
      {
          //lblLoginError.Text = "Invalid username or password";
          Page.RegisterClientScriptBlock("!","<script type=\"text/javascript\">alert(\"Username and Password incorrect\");</script>");
      }
      else 
      {
          string currentpage = Page.Request.Url.AbsoluteUri.ToString();
          Response.Redirect(currentpage.ToString());
      
      }
   
     
         
   
     
 }
开发者ID:goedings,项目名称:VendorLink,代码行数:26,代码来源:login.ascx.cs


示例8: SaveComment

        public void SaveComment(CommentInfo comment)
        {
            var portalSecurity = new PortalSecurity();
            if (!String.IsNullOrEmpty(comment.Comment))
            {
                comment.Comment = HttpUtility.HtmlDecode(portalSecurity.InputFilter(comment.Comment, PortalSecurity.FilterFlag.NoScripting));
                comment.Comment = portalSecurity.InputFilter(comment.Comment, Security.PortalSecurity.FilterFlag.NoMarkup);
            }
            //TODO: enable once the profanity filter is working properly.
            //objCommentInfo.Comment = portalSecurity.Remove(objCommentInfo.Comment, DotNetNuke.Security.PortalSecurity.ConfigType.ListController, "ProfanityFilter", DotNetNuke.Security.PortalSecurity.FilterScope.PortalList);

            if (comment.Comment != null && comment.Comment.Length > 2000)
            {
                comment.Comment = comment.Comment.Substring(0, 1999);
            }
            string xml = null;
            if (comment.CommentXML != null)
            {
                xml = comment.CommentXML.OuterXml;
            }

            comment.CommentId = _dataService.Journal_Comment_Save(comment.JournalId, comment.CommentId, comment.UserId, comment.Comment, xml);
            var newComment = GetComment(comment.CommentId);
            comment.DateCreated = newComment.DateCreated;
            comment.DateUpdated = newComment.DateUpdated;
        }
开发者ID:biganth,项目名称:Curt,代码行数:26,代码来源:InternalJournalControllerImpl.cs


示例9: FilterScripts

			public static string FilterScripts(string text)
			{
				if (string.IsNullOrEmpty(text))
				{
					return string.Empty;
				}
				PortalSecurity objPortalSecurity = new PortalSecurity();
				try
				{
					text = objPortalSecurity.InputFilter(text, PortalSecurity.FilterFlag.NoScripting);
				}
				catch (Exception ex)
				{

				}

				string pattern = "<script.*/*>|</script>|<[a-zA-Z][^>]*=['\"]+javascript:\\w+.*['\"]+>|<\\w+[^>]*\\son\\w+=.*[ /]*>";
				text = Regex.Replace(text, pattern, string.Empty, RegexOptions.IgnoreCase);
				string strip = "/*,*/,alert,document.,window.,eval(,eval[,@import,vbscript,javascript,jscript,msgbox";
				foreach (string s in strip.Split(','))
				{
					if (text.ToUpper().Contains(s.ToUpper()))
					{
						text = text.Replace(s.ToUpper(), string.Empty);
						text = text.Replace(s, string.Empty);
					}
				}
				return text;
			}
开发者ID:allanedk,项目名称:ActiveForums,代码行数:29,代码来源:TextUtils.cs


示例10: OnLoad

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var objSecurity = new PortalSecurity();
            if ((Request.Params["Tag"] != null))
            {
                _tagQuery = HttpContext.Current.Server.HtmlEncode(objSecurity.InputFilter(Request.Params["Tag"], PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoMarkup));
            }

            if (_tagQuery.Length > 0)
            {
            //                if (!Page.IsPostBack)
            //                {
                    BindData();
            //                }
            }
            else
            {
                if (IsEditable)
                {
                   UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("ModuleHidden", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
                }
                else
                {
                    ContainerControl.Visible = false;
                }
            }
        }
开发者ID:hackoose,项目名称:cfi-team05,代码行数:29,代码来源:ContentList.ascx.cs


示例11: SubscriberInfo

 public SubscriberInfo()
 {
     ID = Guid.NewGuid().ToString();
     Name = "";
     Description = "";
     Address = "";
     var oPortalSecurity = new PortalSecurity();
     PrivateKey = oPortalSecurity.CreateKey(16);
 }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:9,代码来源:SubscriberInfo.cs


示例12: DecryptParameter

 public static string DecryptParameter(string value, string encryptionKey)
 {
     var objSecurity = new PortalSecurity();
     //[DNN-8257] - Can't do URLEncode/URLDecode as it introduces issues on decryption (with / = %2f), so we use a modifed Base64
     value = value.Replace("_", "/");
     value = value.Replace("-", "+");
     value = value.Replace("%3d", "=");
     return objSecurity.Decrypt(encryptionKey, value);
 }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:9,代码来源:UrlUtils.cs


示例13: SubscriberInfo

 public SubscriberInfo()
 {
     this._id = Guid.NewGuid().ToString();
     this._name = "";
     this._description = "";
     this._address = "";
     PortalSecurity portalSecurity = new PortalSecurity();
     this._privateKey = portalSecurity.CreateKey( 16 );
 }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:9,代码来源:SubscriberInfo.cs


示例14: GetFile

        private void GetFile(string fileAction, string fileId)
        {
            string fileCheck = Localization.GetString("StoreFile", LocalResourceFile);
            string postData = "";
            Dictionary<string, string> settings = PortalController.GetPortalSettingsDictionary(ModuleContext.PortalId);
            var ps = new PortalSecurity();
            string username = ps.DecryptString(settings["Store_Username"], Config.GetDecryptionkey());
            string password = ps.DecryptString(settings["Store_Password"], Config.GetDecryptionkey());
            postData = postData + "username=" + username + "&password=" + password + "&fileid=" + fileId;

            WebRequest request = WebRequest.Create(fileCheck);

            request.Method = "POST";
            // Create POST data and convert it to a byte array.

            byte[] byteArray = Encoding.UTF8.GetBytes(postData);

            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = byteArray.Length;

            Stream dataStream = request.GetRequestStream();
            dataStream.Write(byteArray, 0, byteArray.Length);
            dataStream.Close();

            WebResponse wr = request.GetResponse();
            string myfile = "";
            string cd = wr.Headers["Content-Disposition"];
            if (cd != null && cd.Trim() != "" && cd.StartsWith("inline;filename="))
            {
                myfile = cd.Replace("inline;filename=", "");
            }

            var objResponse = HttpContext.Current.Response;

            if (fileAction == "download")
            {
                objResponse.AppendHeader("Content-Disposition", "attachment; filename=\"" + myfile + "\"");
                objResponse.AppendHeader("Content-Length", wr.ContentLength.ToString());
                objResponse.ContentType = wr.ContentType;

                const int bufferLength = 4096;
                byte[] byteBuffer = new byte[bufferLength];
                Stream rs = wr.GetResponseStream();
                int len = 0;
                while ((len = rs.Read(byteBuffer, 0, byteBuffer.Length)) > 0)
                {
                    if (len < bufferLength)
                    { objResponse.BinaryWrite(byteBuffer.Take(len).ToArray()); }
                    else
                    { objResponse.BinaryWrite(byteBuffer); }
                    objResponse.Flush();
                }
            }
        }
开发者ID:davidsports,项目名称:Dnn.Platform,代码行数:54,代码来源:PurchasedExtensions.ascx.cs


示例15: btnProcess_Click

        protected void btnProcess_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            StoreInfo storeInfo = CheckoutControl.StoreData;
            IAddressInfo shippingAddress = CheckoutControl.ShippingAddress;
            IAddressInfo billingAddress = CheckoutControl.BillingAddress;
            OrderInfo orderInfo = CheckoutControl.GetFinalizedOrderInfo();
            //lblOrderNumber.Text = orderInfo.OrderID.ToString();

            PortalSecurity security = new PortalSecurity();

            TransactionDetails transaction = new TransactionDetails();
            //transaction.CardType = (TransactionDetails.CardTypes)Enum.Parse(typeof(TransactionDetails.CardTypes), rbCard.SelectedValue);
            //transaction.CardType = null;
            transaction.CardNumber = security.InputFilter(txtNumber.Text, PortalSecurity.FilterFlag.NoMarkup | PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoSQL);;
            //transaction.NameOnCard = security.InputFilter(txtName.Text, PortalSecurity.FilterFlag.NoMarkup | PortalSecurity.FilterFlag.NoScripting | PortalSecurity.FilterFlag.NoSQL);;
            transaction.NameOnCard = string.Empty;
            transaction.VerificationCode = int.Parse(txtVer.Text);
            transaction.ExpirationMonth = int.Parse(ddlMonth.SelectedValue);
            transaction.ExpirationYear = int.Parse(ddlYear.SelectedValue);

            if (transaction.IsValid())
            {
                AuthNetGatewayProvider provider = new AuthNetGatewayProvider(storeInfo.GatewaySettings);

                TransactionResult orderResult = provider.ProcessTransaction(shippingAddress, billingAddress, orderInfo, transaction.ToString());
                if (!orderResult.Succeeded)
                {
                    litError.Text = Localization.GetString(orderResult.Message.ToString(), this.LocalResourceFile);
                }
                else
                {
                    invokePaymentSucceeded();

                    //Clear basket
                    CurrentCart.ClearItems(PortalId);

                    //Clear cookies
                    SetOrderIdCookie(-1);
                }
            }
            else
            {
                litError.Text = Localization.GetString("ErrorCardNotValid", this.LocalResourceFile);
            }
        }
开发者ID:helder1978,项目名称:Store,代码行数:51,代码来源:AuthorizeNetPayment.ascx.cs


示例16: GetTagsCompletionList

        public string[] GetTagsCompletionList(string prefixText, int count, string contextKey)
        {
            var objSecurity = new PortalSecurity();

            DataTable dt = Tag.GetTagsByString(objSecurity.InputFilter(HttpUtility.UrlDecode(prefixText), PortalSecurity.FilterFlag.NoSQL), Convert.ToInt32(contextKey, CultureInfo.InvariantCulture));

            var returnTags = new string[dt.Rows.Count];
            foreach (DataRow dr in dt.Rows)
            {
                returnTags[0] = dr["name"].ToString();
            }

            return returnTags;
        }
开发者ID:ChrisHammond,项目名称:Engage-Publish,代码行数:14,代码来源:PublishServices.asmx.cs


示例17: OnLoad

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!Page.IsPostBack)
            {
                PortalSecurity ps = new PortalSecurity();
                Dictionary<string, string> settings = PortalController.GetPortalSettingsDictionary(ModuleContext.PortalId);
                if (settings.ContainsKey("Store_Username"))
                { txtUsername.Text = ps.DecryptString(settings["Store_Username"], Config.GetDecryptionkey()); }

                if (settings.ContainsKey("Store_Username"))
                { txtPassword.Text = ps.DecryptString(settings["Store_Password"], Config.GetDecryptionkey()); }
            }
        }
开发者ID:hackoose,项目名称:cfi-team05,代码行数:15,代码来源:Store.ascx.cs


示例18: DoLogoff

		private void DoLogoff()
		{
			try
			{
				//Remove user from cache
				if (User != null)
				{
					DataCache.ClearUserCache(PortalSettings.PortalId, Context.User.Identity.Name);
				}
				var objPortalSecurity = new PortalSecurity();
				objPortalSecurity.SignOut();
			}
			catch (Exception exc)	//Page failed to load
			{
				Exceptions.ProcessPageLoadException(exc);
			}
		}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:17,代码来源:Logoff.ascx.cs


示例19: Login

 public HttpResponseMessage Login(loginDTO postData)
 {
     UserLoginStatus loginStatus = UserLoginStatus.LOGIN_FAILURE;
     string userName = new PortalSecurity().InputFilter(postData.Username,
         PortalSecurity.FilterFlag.NoScripting |
         PortalSecurity.FilterFlag.NoAngleBrackets |
         PortalSecurity.FilterFlag.NoMarkup);
     var objUser = UserController.ValidateUser(PortalSettings.PortalId, userName, postData.Password, "DNN", string.Empty, PortalSettings.PortalName, AuthenticationLoginBase.GetIPAddress(), ref loginStatus);
     switch (loginStatus)
     {
         case UserLoginStatus.LOGIN_SUCCESS:
         case UserLoginStatus.LOGIN_SUPERUSER:
         case UserLoginStatus.LOGIN_INSECUREADMINPASSWORD:
         case UserLoginStatus.LOGIN_INSECUREHOSTPASSWORD:
             UserController.UserLogin(PortalSettings.PortalId, objUser, "", AuthenticationLoginBase.GetIPAddress(), postData.sc);
             return Request.CreateResponse(HttpStatusCode.OK, loginStatus.ToString());
         default:
             return Request.CreateResponse(HttpStatusCode.Unauthorized, loginStatus.ToString());
     }
 }
开发者ID:DNN-Connect,项目名称:SkinControls,代码行数:20,代码来源:DnnController.cs


示例20: DeserializeMessage

        private EventMessage DeserializeMessage( string filePath, string subscriberId )
        {
            EventMessage message = new EventMessage();
            StreamReader oStreamReader = File.OpenText( filePath );
            string messageString = oStreamReader.ReadToEnd();
            if( messageString.IndexOf( "EventMessage" ) < 0 )
            {
                PortalSecurity oPortalSecurity = new PortalSecurity();
                messageString = oPortalSecurity.Decrypt( EventQueueConfiguration.GetConfig().EventQueueSubscribers[subscriberId].PrivateKey, messageString );
            }
            message.Deserialize( messageString );
            oStreamReader.Close();

            //remove the persisted message from the queue if it has expired
            if( message.ExpirationDate < DateTime.Now )
            {
                File.Delete( filePath );
            }

            return message;
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:21,代码来源:EventQueueController.cs



注:本文中的DotNetNuke.Security.PortalSecurity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Permissions.PermissionController类代码示例发布时间:2022-05-24
下一篇:
C# Users.UserInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap