Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Creating Custom Login Form View modes: 
User avatar
Member
Member
JasonSP - 8/23/2010 10:58:33 AM
   
Creating Custom Login Form
I have searched all over the web and this forum but haven't figured out how to do what I need. I have been using Kentico for a few years now for different sites and this is the first time I ran across something that I could not figure out how to do.

From my understanding Kentico and in more particular ASP.Net does not allow you to have more than 1 <form> tag on a page since ASP.Net uses this tag.

I need to creat a custom login form that users will use to sign into a third party .Net application. I contacted the developers of this 3rd party application and told them my situation and they gave me some instructions and code to use but I still can not figure out how to incorporate this into Kentico. Due to the requirements I can not use an iFrame so I think it would require me to create a custom web part to do this. I have never created a custom web part and I am looking for some guidance to get me going in the right direction.

I am using the Portal Engine and version 5.

Below is the code and instructions sent to me from the 3rd party developers. I would GREATLY appreciate it if anyone can help lead me in the right direction to get this accomplished.


How-to: Integrate the ClientWeb Login using C#/ASPX.

The CADENCE ClientWeb provides a proxy login ASPX file for you to integrate the ClientWeb with another web application. The name of the proxy page is Login_Proxy.aspx and it is located in the root of the ClientWeb application.

The proxy functionality accepts a company name, user name, password, database index and a return URL for the ASPX web page.

The database index coincides with the index value of the database found in the CADENCE control file located in the ClientWeb application folder.

The return URL is the address of the web page that will handle any exception returned by the proxy function. The proxy function will return any exception or failed login message in the query string variable named “msg”.

Below is a sample of an ASPX Form that requests from the user a company name, user name and password. This form also contains two (2) hidden variables storing the database index and the return URL values. The names of these inputs are UserName, Password, DBIndex, and ReturnUrl .



<form id="form1" method="post" action="http://localhost:56786/Login_Proxy.aspx">
<div>
<table border="0" cellpadding="1" cellspacing="0" width="300">
<tr>
<td align="right"><asp:Label ID="lbl_Company" Text="Company: " runat="server" /></td>
<td align="left"><input type="text" value="20101" name="Company" size="20" /></td>
</tr>
<tr>
<td align="right"><asp:Label ID="lbl_UserId" Text="User ID: " runat="server" /></td>
<td align="left"><input type="text" name="UserName" size="20" /></td>
</tr>
<tr>
<td align="right"><asp:Label ID="lbl_Password" Text="Password: " runat="server" /></td>
<td align="left">
<input type="text" name="Password" value="" size="20" />
<input type="hidden" name="DbIndex" value="0" />
<input type="hidden" name="ReturnUrl"
value="http://localhost:57017/TestWebsite/Default.aspx" />
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input id="Submit1" type="submit" value="submit" />
</td>
</tr>
<tr>
<td colspan="2"><asp:Label ID="lblMessage" Text="" ForeColor="Red" runat="server" /></td>
</tr>
</table>
</div>
</form>



Below is a sample of an ASPX code behind function that handles the return message of the proxy page.



protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["msg"] != null)
{
lblMessage.Text = Request.QueryString["msg"].ToString();
}
}


Thanks in advance!!

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 8/24/2010 3:21:38 AM
   
RE:Creating Custom Login Form
Hi,

As you told, you will need to develop your custom webpart:
http://devnet.kentico.com/docs/devguide/developing_web_parts.htm

If you cannot use iframe, it is not possible to use provided custom form (as you told, you cannot use two forms).

You will need to ask your authentication provider to develop same functionality that can be used for authentication (some service or some special page you can call). You will call this service or special page from your custom webpart to authenticate.

Another possibility is to post data by POST method to same URL using webrequest .net class: http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx
In your webpart you do not need to use FORM html tag, that will post data to same URL. The webrequest class will do the same.

Best regards,
Ivana Tomanickova