2015年10月27日 星期二

DNN - 如何修改隱私權內文

Go to menu "Admin > Languages" and click for edit its content for the site or the host.
Keep on the edition of the "GlobalResources" file.
Search for "MESSAGE_PORTAL_PRIVACY.Text" and "MESSAGE_PORTAL_TERMS.Text" and modify them.

DNN - UserProfile圖像無法顯示

解決方法:
系統管理員登入
主機管理-->SiteManagement
進階設定-->網站別名-->Default Alias-->"Dnnap/dnn"

DNN - Images放置位置

C:\inetpub\wwwroot\DNN\images

DNN - 調整網站時區

網站設定-->進階設定-->可用性設定-->網站時區 (UTC+08:00)

DNN - AD登入如何設定DefaultButton


修改Login.ascx

C:\inetpub\wwwroot\DNN\DesktopModules\AuthenticationServices\ActiveDirectory\Login.ascx



主要是增加一個Panel 並且設定好 DefaultButton="cmdLogin"

例:

<div class="dnnForm dnnLoginService dnnClear">
<asp:Panel ID="pnlLogon" runat="server" DefaultButton="cmdLogin" Width="100%" >
    <div class="dnnFormItem">
        <asp:label id="plUsername" AssociatedControlID="txtUsername" runat="server" resourcekey="Username" CssClass="dnnFormLabel" />
        <asp:textbox id="txtUsername" runat="server" />
    </div>
    <div class="dnnFormItem">
        <asp:label id="plPassword" AssociatedControlID="txtPassword" runat="server" resourcekey="Password" CssClass="dnnFormLabel" />
        <asp:textbox id="txtPassword" textmode="Password" runat="server" />
    </div>
    <div class="dnnFormItem" id="divCaptcha1" runat="server" visible="false">
        <asp:label id="plCaptcha" AssociatedControlID="ctlCaptcha" runat="server" resourcekey="Captcha" CssClass="dnnFormLabel" />
    </div>
    <div class="dnnFormItem" id="divCaptcha2" runat="server" visible="false">
        <dnn:captchacontrol id="ctlCaptcha" captchawidth="130" captchaheight="40" runat="server" errorstyle-cssclass="dnnFormMessage dnnFormError" />
    </div>
    <p><asp:LinkButton id="cmdLogin" resourcekey="cmdLogin" cssclass="dnnPrimaryAction" text="Login" runat="server" /></p>
</asp:Panel>
</div>

DNN - User反應無法登入,查看EvenLog 出現 "Validation of viewstate MAC failed"

可能可以用下面方法解決

參考網址:
http://blog.janjonas.net/2013-04-18/dotnetnuke-workaround-validation-viewstate-failed-exception-dnn_7-login-form

DotNetNuke: Workaround for “Validation of viewstate MAC failed” exception when using the DNN 7 login form in multiple tabs

DotNetNuke: Workaround for “Validation of viewstate MAC failed” exception when using the DNN 7 login form in multiple tabs
Jan Jonas April 18th, 2013 Comments: 8Categories: Howto, ProgrammingAs I’ve written in one of my previous posts, I found out that one gets a “Validation of viewstate MAC failed” exception when submitting a DNN login form and the login status has changed from “not logged in” to “logged in” after the login form initially was loaded (e.g. by using an addition browser tab to log in).
After contacting the DNN support team it turned out, that this is not a bug, but a security feature in DNN. In detail, DNN adds the username of the current session to the APS.NET ViewStateUserKey (see “Take Advantage of ASP.NET Built-in Features to Fend Off Web Attacks” on MSDN for more information).
In DNN profession knowledge base, two resolutions are described which both have their drawbacks:
•One could edit the Default.aspx.cs and remove the username from the ViewStateUserKey which has to be done after each DNN update because Default.aspx.cs will be overwritten when updating the framework.
•One could disable “ViewState MAC validation” entirely by setting enableViewStateMac to false in Web.config file which is not recommended due to security problems.I finally came up with the following code snippet that I’ve added to the code behind file of the skin:


protected override void OnInit(EventArgs e)
{
  // Catch "Validation of viewstate MAC failed" exceptions and redirect the user
  // to the current page (i.e. force a redirect on the client)
  Page.Error += (sender, args) =>
  {
    if (!(HttpContext.Current.Error is HttpException)) return;
    if (!(HttpContext.Current.Error.InnerException is ViewStateException)) return;

    HttpContext.Current.Response.Clear();
    Response.Redirect(Request.UrlReferrer == null ? Request.Url.ToString() : Request.UrlReferrer.ToString());
  };

  base.OnInit(e);
}

In detail the code above adds an error handler that catches “Validation of viewstate MAC failed” exceptions and forces the client to reload the current page in case of such an excpetion (which updates the ViewStateUserKey according to the current session state). Since this error handler needs to be added on every page, the skin is the perfect place to put the code into.
Related posts:
1DotNetNuke: “Validation of viewstate MAC failed” exception when using the DNN 7 login form in multiple tabs 2ASP.NET MVC 3: Ajax Form with jQuery validate supporting (unobtrusive) Client Side Validation and Server Side Validation 3ASP.NET MVC 3: Using jQuery .ajax() function to submit Ajax Form supporting (unobtrusive) Client Side Validation and Server Side Validation 4ASP.NET MVC 3: Using JSON result for jQuery Ajax Forms validation 5ASP.NET MVC 3: Validate complex Types (Objects & Lists) in Ajax Form using jQuery and JSON on Client Side and Server Side

DNN - 隱藏原DNN系統的登入頁簽

編輯
C:\inetpub\wwwroot\DNN706\DesktopModules\AuthenticationServices\DNN\Login.ascx

<!-- 20150709 隱藏 原DNN系統的登入頁簽-->
<%@ DNN:DNNTabStrip
    ID="tsLogin"
    runat="server"
    TabRenderMode="All"
    CssTabContainer="LoginTabGroup"
    CssContentContainer="LoginContainerGroup"
    DefaultContainerCssClass="LoginContainer"
    DefaultLabel-CssClass="LoginTab"
    DefaultLabel-CssClassHover="LoginTabHover"
    DefaultLabel-CssClassSelected="LoginTabSelected"
    visible="false"
    SelectedIndex="1" %>
<!-- ~~ -->

DNN - 修改字型的方法

C:\inetpub\wwwroot\DNN\Portals\_default\Skins\Gravity\skin.css

找到 font-family ,在這之後增加 "字型名稱"

例:

微軟正黑體
font-family: Microsoft JhengHei

DNN - 開啟UserOnline功能

1. Host--> Host Settings --> 關閉 Users Online 模組的功能? ==> 取消勾選

2. Host--> 排程 --> Purge Users Online --> 啟用排程 --> RunNow --> update

3. 連至DataBase --> DNN DB --> select * from UsersOnline

DNN - 使用NPOI元件時References ICSharpCode.SharpZipLib.dll 會出現問題

一開始是把

ICSharpCode.SharpZipLib.dll
NPOI.dll
NPOI.OOXML.dll
NPOI.OpenXml4Net.dll
NPOI.OpenXmlFormats.dll

5個DLL檔放置於 C:\inetpub\wwwroot\DNN\bin\

此時再上傳安裝新的Module時會出現DLL衝突的異常畫面

後來把 ICSharpCode.SharpZipLib.dll 移入 C:\inetpub\wwwroot\DNN\bin\Providers
即可改善此問題。

猜想應該是 DNN原本內建的 SharpZipLib.dll 與 NPOI 內建的 ICSharpCode.SharpZipLib.dll 相衝突

DNN - 中文Menu彈跳視窗異常

DNN 7.0.X Bug

網站管理-->網站設定-->可用性設定-->(取消勾選)Enable Pop-Ups

DNN - 串登入者資訊

private UserInfo _currentUser =
DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo();


or


DotNetNuke.Entities.Users.UserInfo user = DotNetNuke.Entities.Users.UserController.GetUser(PortalSettings.PortalId, user_id, true);


or


Dim nowUser As UserInfo = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo
response.write(nowUser)

2015年10月13日 星期二

Highcharts-參考範例

Highcharts 這個套件似乎蠻有趣的,先收集一下相關教學,有空時再來玩玩

Highstock Demos
http://www.highcharts.com/stock/demo

Highcharts Asp.net: Create Pie chart with jQuery ajax in C# (MS SQL database)
http://codepedia.info/2015/07/highcharts-asp-net-create-pie-chart-with-jquery-ajax-in-c-sharp-ms-sql-database/

Highcharts in asp.net using jquery ajax
http://www.codeproject.com/Articles/820349/Highcharts-in-asp-net-using-jquery-ajax

Highchart with C# and Data from database
http://highchartsdata.blogspot.tw/2013/04/highchart-with-c-and-data-from-database.html

在 Asp.net 中使用 DataTable 作為 Highcharts 資料來源
http://thedeadbody.blogspot.tw/2014/07/aspnet-datatable-highcharts.html

highcharts plugin Demo
http://w3937.pixnet.net/blog/post/96638123-%5Bjquery%5D-highcharts-plugin-demo

強大的jQuery圖表套件-Highcharts
http://www.dotblogs.com.tw/lastsecret/archive/2011/01/30/21137.aspx

jquery图表插件highcharts
http://blog.csdn.net/xuqianghit/article/details/6196276

如何讓HighCharts支援圖表匯出中文檔名 using C# MVC4
http://pinylnln.pixnet.net/blog/post/45015932-%E5%A6%82%E4%BD%95%E8%AE%93highcharts%E6%94%AF%E6%8F%B4%E5%9C%96%E8%A1%A8%E5%8C%AF%E5%87%BA%E4%B8%AD%E6%96%87%E6%AA%94%E5%90%8D-using-c%23-m

Highstock K線圖教學1
http://www.peng8.net/2015/02/06/how-to-use-highstock-with-kline/

Highstock K線圖教學2
http://annan211.iteye.com/blog/2058913

Highstock K線圖教學3
http://www.xuebuyuan.com/2049467.html