473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Subit ASP.NET WebForm to ActionHandlers

Hi,

Good morning. Iam currently working on a J2EE to .NET migration project where i have to implement the java technologies that are used in the application to the equivalent .NET technologies. I have a very seriously troubling query to solve in the application. Iam implementing the Java Struts thru HttpHandlers(web.config) in the application. For this iam using the Web.config where iam specifying the action handlers for the web pages that I want to handle. Now, my problem is that, iam submitting the login form which will redirect(I have used Response.Redirect as Server.Transfer is giving an error while redirection to the specified action handler) to the action handler class on submission and iam trying to read the form elements(thru getting the Request object from Context object which it comes as a parameter to the handler class). But it is not giving the values for the submitted the login form. Iam getting the null values. What is the reason behind this? If iam using Server.Transfer then it is giving an error while redirection to the action handler. Request.Redirect is working fine, but iam unable to read the values of the submitted form. My source code is as below:
Login Page: (Login.aspx) - I have removed the unnecessary design elements and jst given the form elements for reference

<hrml><body leftMargin=0 topMargin=0 MS_POSITIONING="GridLayout"><form method=post runat="server">

Login :

<asp:textbox id=PasswordTag6 Runat="server" TextMode="Password" MaxLength="64" CssClass="skb_query"></asp:textbox><br>

Password :

<asp:textbox id=PasswordTag6 Runat="server" TextMode="Password" MaxLength="64" CssClass="skb_query"></asp:textbox><br><asp:button id=btnSubmit runat="server" Text="Submit" Width="80px" Height="24px"></asp:Button></form></body></html>
(Login.aspx.cs)

protected void btnSubmit_Click(object sender, System.EventArgs e)
{
Response.Redirect("ActionController.aspx");
}

Web.config:

<?xml version="1.0" encoding="utf-8" ?><configuration><configSections><section name="ActionSettings" type="System.Configuration.NameValueFileSectionHan dler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /><section name="GlobalForwards" type="System.Configuration.NameValueFileSectionHan dler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /></configSections><system.web><httpHandlers><add verb="*" path="*ActionController.aspx" type="MyActionFrontController.FrontControllerHandl er, MyActionFrontController"/><add verb="*" path="*Failure*.aspx" type="MyActionFrontController.FrontControllerHandl er, MyActionFrontController"/></httpHandlers></system.web><GlobalForwards><add key="globalTest" value="/FrontController/myGlobal.aspx"/><add key="error" value="/FrontController/error.aspx"/></GlobalForwards><ActionSettings><add key="/MyActionFrontController/ActionController.aspx.action" value="MyActionFrontController.LoginAction"/><add key="/MyActionFrontController/ActionController.aspx.failure" value="/MyActionFrontController/LoginFailure.aspx"/><add key="/MyActionFrontController/ActionController.aspx.success" value="/MyActionFrontController/LoginDetails.aspx"/></ActionSettings></configuration>

Action Handler(FrontControllerHandler.cs):

using System;

using System.Web;

using System.Collections;

using System.Web.SessionState;

namespace MyActionFrontController

{

public class FrontControllerHandler : IHttpHandler, System.Web.SessionState.IRequiresSessionState

{

public void ProcessRequest(HttpContext context)

{

try

{

// Get the HttpContext object for the current HTTP request.

HttpContext objHttpContext;

objHttpContext = HttpContext.Current;

// Get the Response object.

HttpRequest objHttpRequest;

objHttpRequest = objHttpContext.Request;

string username = objHttpRequest.Form["TextTag5"]; //iam getting “null” value here

string password = objHttpRequest.Form["PasswordTag6"]; //iam getting “null” value here

-------

-------

-------

}

catch (System.Threading.ThreadAbortException)

{

}

}

public bool IsReusable

{

get

{

return true;

} // get

} // IsReusable property

}

}

The action handlers are working fine and on submitting the Login page, the control is transferred to the above action handler class(FrontControllerHandler.cs), but in the execute method iam facing the problem of reading the submitted form values(User login and password textboxesalues). What I understood is that I cannot use Server.Transfer for redirection to Actionhandlers(as it is giving an error while redirection to the action handler class, FrontControllerHandler.cs), but Server.Transfer will post the form submitted values to the next program so that I can read the form values thru Request.Form[<index/name>] collection. Where as Response.Redirect is working fine in my case(i.e it is successfully readirecting to the action handler class, FrontControllerHandler.cs) but iam unable to access the submitted form values in the ProcessRequest method. This is really confusing me. Iam really struck up with this problem. Could you please let me know the solution to this. Thanking you very much in advance.

Regards,
Nagalinga Reddy Kapu
Senior Developer
Aztec Software and Technology Services Limited
# 23, III A Cross, 18th Main, 6th Block
Koramangala, Bangalore - 560 095
Phone: +91-80-5522892, Extn. 343
Email: na********@aztec.soft.net
Nov 18 '05 #1
0 1018

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andrew | last post by:
Hi, Until now, I have used a single webform for my web app, and everything's been OK. Now, I've decided to create a main menu webform. So, I've got two webforms. Using Visual Studio .NET (with...
1
by: hqdtech | last post by:
how to refresh webform from other webform I have 2 webform, i want if webform A was close then webform B wil refresh. And the problem second: how to catch packet on the network in C#. ...
3
by: trint | last post by:
Ok, I have tried to do this with the System.Web.UI and can't find anything for the webform. It seems much easier for a Winform. Any help in trapping Webform keydown event and keyup event is...
5
by: Jerry | last post by:
I am using .Net 2003. I have been working with this ASP.Net webform that I created a few weeks ago. It has been working fine. However, while modifying the webform today, this webform stopped...
2
by: Craig Douthitt via DotNetMonster.com | last post by:
I am trying to capture an buttonclick on a usercontrol in the webform the usercontrol resides in. After researching this issue, I've come to believe that the best way of handling this is by raising...
6
by: Skeptical | last post by:
Hello, I am trying to embed html output into my webform but could not figure out how to so far. The form will execute a Perl script with some parameters, and script will output some html...
2
by: Rob | last post by:
I have a webform that uses the TabStrip and MultiPage webcontrols. I also have a Print button on the form to print all of the information of the webform (all tabs): <input type="button"...
3
by: Dean Slindee | last post by:
Would like to call the TabShow function on WebForm InOutHost from another WebForm in same project, but cannot figure out how to get a reference. Can this be done? In this statement: Call...
5
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have start web form and when the user clicks a button (server.transfer) they are directed to the second webform. I was wondering if there is a way to create an instance of the first webform...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.