PortalSettings currentPortal = PortalController.GetCurrentPortalSettings();
UserLoginStatus loginStatus = new UserLoginStatus();
UserInfo objUser = UserController.ValidateUser(
currentPortal.PortalId,
ConfigurationSettings.AppSettings["DnnLoginUser"],
ConfigurationSettings.AppSettings["DnnLoginPassword"],
"DNN", "",
currentPortal.PortalName, HttpContext.Current.Request.UserHostAddress, ref loginStatus);
if (loginStatus == UserLoginStatus.LOGIN_SUCCESS)
{
UserController.UserLogin
(currentPortal.PortalId,
objUser, currentPortal.PortalName,
HttpContext.Current.Request.UserHostAddress, false);
}
Wednesday, June 30, 2010
Monday, June 28, 2010
disable enter key
<asp:TextBox onKeyPress="return disableEnterKey(event)" runat="server" name="txtUserName" ID="txtUserName" MaxLength="20" Width="135px"></asp:TextBox>
function disableEnterKey(e) {
var key;
if (window.event)
key = window.event.keyCode; //IE
else
key = e.which; //firefox
return (key != 13);
}
function disableEnterKey(e) {
var key;
if (window.event)
key = window.event.keyCode; //IE
else
key = e.which; //firefox
return (key != 13);
}
Monday, June 14, 2010
Setup Ubuntu as web server
http://www.securenetwork.it/ricerca/whitepaper/download/Debian-Ubuntu_hardening_guide.pdf
SELinux for Ubuntu Server:
http://selinuxproject.org/files/2008_selinux_developer_summit/2008_summit_brindle_ubuntu.pdf
The installation is as simple as:
Sudo apt-get install selinux
SELinux disables AppArmour
SELinux for Ubuntu Server:
http://selinuxproject.org/files/2008_selinux_developer_summit/2008_summit_brindle_ubuntu.pdf
The installation is as simple as:
Sudo apt-get install selinux
SELinux disables AppArmour
Wednesday, June 2, 2010
POST in asp.NET page without nesting forms
if (!IsPostBack)
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), "postback", "function doExternalPost(targetUrl) { theForm.__VIEWSTATE.value = ''; theForm.encoding = 'application/x-www-form-urlencoded'; theForm.action = targetUrl; theForm.submit(); }", true);
}
litText.Text = string.Format("<input name="postInfo" value="{0}" type="hidden"><a onclick="\"javascript:doExternalPost('{1}');\"">clickme</a>", "prodABC" , "postURL");
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), "postback", "function doExternalPost(targetUrl) { theForm.__VIEWSTATE.value = ''; theForm.encoding = 'application/x-www-form-urlencoded'; theForm.action = targetUrl; theForm.submit(); }", true);
}
litText.Text = string.Format("<input name="postInfo" value="{0}" type="hidden"><a onclick="\"javascript:doExternalPost('{1}');\"">clickme</a>", "prodABC" , "postURL");
Tuesday, June 1, 2010
reference jQuery in Visual Studio
<%if (false) { %>
<script language="javascript" type="text/javascript" src="../../Resources/Shared/scripts/jquery/jquery-1.4.2.js"></script>
<script language="javascript" type="text/javascript" src="../../Resources/Shared/scripts/jquery/jquery-1.4.2-vsdoc.js"></script>
<%} %>
<script language="javascript" type="text/javascript"><br /><br /> $(document).ready(function() {<br /><br /> });<br /><br /></script>
<script language="javascript" type="text/javascript" src="../../Resources/Shared/scripts/jquery/jquery-1.4.2.js"></script>
<script language="javascript" type="text/javascript" src="../../Resources/Shared/scripts/jquery/jquery-1.4.2-vsdoc.js"></script>
<%} %>
<script language="javascript" type="text/javascript"><br /><br /> $(document).ready(function() {<br /><br /> });<br /><br /></script>
Saturday, May 22, 2010
iPhone unlock
Firmware: current version 3.1.3, can be jailbroken easily now. Unlock has nothing to do with jailbreak. If update the firmware, baseband will be automatically updated.
Baseband: control the GSM frequency. This is how Apple lock iPhone to stop people use it under other GSM network rather than AT&T. Due to T-mobile has similar frequency, locked iPhone can be used under T-mobile some how. The latest baseband 5.12.01 hasn't been unlocked yet (except some videos on YouTube), so hacker need to downgrade it to 5.11 to unlock iPhone. However, the latest bootloader 5.9 has fix the bug which allows people downgrade baseband from 5.12.01.
Bootloader: it is a hardware, can't be upgrade/downgrade unless modify the iPhone hardware, just like the camera. Only the bootloader before 5.9 has the bug to allow people downgrade baseband. However, most of the new iPhone 3G/3GS is using the bootloader 5.9.
Baseband: control the GSM frequency. This is how Apple lock iPhone to stop people use it under other GSM network rather than AT&T. Due to T-mobile has similar frequency, locked iPhone can be used under T-mobile some how. The latest baseband 5.12.01 hasn't been unlocked yet (except some videos on YouTube), so hacker need to downgrade it to 5.11 to unlock iPhone. However, the latest bootloader 5.9 has fix the bug which allows people downgrade baseband from 5.12.01.
Bootloader: it is a hardware, can't be upgrade/downgrade unless modify the iPhone hardware, just like the camera. Only the bootloader before 5.9 has the bug to allow people downgrade baseband. However, most of the new iPhone 3G/3GS is using the bootloader 5.9.
Friday, May 7, 2010
Loading UserControl Dynamically in UpdatePanel
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:updatepanel id="pnl1" runat="server">
<contenttemplate>
<asp:placeholder id="plh1" runat="server"></asp:PlaceHolder>
</contenttemplate>
</asp:UpdatePanel>
private string LastLoadedControl
{
get
{
return ViewState["LastLoaded"] as string;
}
set
{
ViewState["LastLoaded"] = value;
}
}
private void LoadUserControl()
{
string controlPath = LastLoadedControl;
if (!string.IsNullOrEmpty(controlPath))
{
plh1.Controls.Clear();
UserControl uc = (UserControl)LoadControl(controlPath);
plh1.Controls.Add(uc);
}
}
protected void Page_Load(object sender, EventArgs e)
{
DotNetNuke.Framework.AJAX.RegisterScriptManager();
string controlPath = string.Empty;
if (Settings.ContainsKey("ddl1"))
controlPath = Settings["ddl1"] + ".ascx";
else
controlPath = "Expired.ascx";
LastLoadedControl = controlPath;
LoadUserControl();
}
<asp:updatepanel id="pnl1" runat="server">
<contenttemplate>
<asp:placeholder id="plh1" runat="server"></asp:PlaceHolder>
</contenttemplate>
</asp:UpdatePanel>
private string LastLoadedControl
{
get
{
return ViewState["LastLoaded"] as string;
}
set
{
ViewState["LastLoaded"] = value;
}
}
private void LoadUserControl()
{
string controlPath = LastLoadedControl;
if (!string.IsNullOrEmpty(controlPath))
{
plh1.Controls.Clear();
UserControl uc = (UserControl)LoadControl(controlPath);
plh1.Controls.Add(uc);
}
}
protected void Page_Load(object sender, EventArgs e)
{
DotNetNuke.Framework.AJAX.RegisterScriptManager();
string controlPath = string.Empty;
if (Settings.ContainsKey("ddl1"))
controlPath = Settings["ddl1"] + ".ascx";
else
controlPath = "Expired.ascx";
LastLoadedControl = controlPath;
LoadUserControl();
}
Subscribe to:
Posts (Atom)