
anup_daware
Members-
Posts
25 -
Joined
-
Last visited
About anup_daware
- Birthday 02/27/1983
Personal Information
-
Occupation
Software Developer
-
Visual Studio .NET Version
VS 2005
-
.NET Preferred Language
C#,C++,Jscript
anup_daware's Achievements
Newbie (1/14)
0
Reputation
-
Hi All, I am facing this very weird issue, for every server request my control is redirecting to the login page and again coming back to the actual page from where the request was initiated when I set my custom Remember be cookie on the login page. Following are the details: 1. Authentication mode is �Forms� 2. This issue is reproducible only in deployed applications, I found this using my trace and remote debugging 3. This issue occurs only when user selects the �Remember Me� option at the time of login, then I set the custom cookie for storing the user info. (inbuilt Remember Me of login control is not used as I need the fixed expiration and not the sliding one) 4. It is also observed that issue occurs only when I create a msi and deploy it, if I just take the code and publish it on server the application works fine and there are no unnecessary redirections to login 5. Application is Ajax enabled //Following is the code where I set the cookie used for remember me: 2 // To store the authentication cookie. 3 HttpCookie myTLCookie = new HttpCookie("UserCookie"); 4 Response.Cookies.Remove("UserCookie"); 5 //Save username and password in the cookie. 6 myTLCookie.Values["Username"] = LoginTyreLink.UserName; 7 myTLCookie.Values["Password"] = LoginTyreLink.Password; 8 myTLCookie.Values["LanguageCodeForMegaFleet"] = (((DropDownList)LoginTyreLink.FindControl("dropDownListLanguage")).SelectedItem.Value).Substring(6, 3); 9 myTLCookie.Values["UICulture"] = (((DropDownList)LoginTyreLink.FindControl("dropDownListLanguage")).SelectedItem.Value).Substring(0, 5); 10 myTLCookie.Values["Culture"] = (((DropDownList)LoginTyreLink.FindControl("dropDownListLanguage")).SelectedItem.Value).Substring(0, 5); 11 myTLCookie.Values["LanguageForTyreDetails"] = (((DropDownList)LoginTyreLink.FindControl("dropDownListLanguage")).SelectedItem.Value).Substring(10); 12 myTLCookie.Values["ClientOffsetTime"] = SessionManager.CurrentUser.GetTimezoneOffset().ToString(); 13 14 // Read the expiry period from the session and set the cookie life time of the cookie accordingly. 15 // Note that the client local time is used to decide the cookie expiry time 16 myTLCookie.Expires = Time.AddHours(double.Parse(ConfigurationManager.AppSettings.Get("SessionTimeout").ToString())); 17 try 18 { 19 HttpCookie encodedCookie = Utilities.HttpSecureCookie.Encode(myTLCookie); 20 Response.Cookies.Add(encodedCookie); 21 } 22 catch (Exception exp) 23 { 24 HandleException(exp); 25 } 26 //Following the is the code that reads the Remember Me cookie at the time of load of login page and sets the authentication cookie: 2 if (Request.Cookies.Get("UserCookie") != null) 3 { 4 HttpCookie cookie = Request.Cookies.Get("UserCookie"); 5 HttpCookie decodedCookie = Utilities.HttpSecureCookie.Decode(cookie); 6 if (decodedCookie.Values["Username"] != null && decodedCookie.Values["Password"] != null) 7 { 8 if (ValidateUser(decodedCookie.Values["Username"].ToString(), decodedCookie.Values["Password"].ToString(),0.0)) 9 { 10 FormsAuthentication.SetAuthCookie(decodedCookie.Values["Username"].ToString(), false); 11 Response.Redirect(LoginControl.DestinationPageUrl); 12 } 13 } 14 } While I am probably almost certain that the issue is with Forms Authentication and Cookies, I am not able figure out what it could be. Please help. Thanks, Anup
-
In my ASP.Net project we use LDAP for authentication purposes. I want to enforce following security policies. Mandatory password change at the time of first login Mandatory password change after specific time My question is, is there any way I can delegate this policy enforcement on LDAP side, so when user tries to log in for the first time if LDAP throws some error code which signifies that this login is used for the first time, similarly if user has not changed the password since say for one month, at the time of login if LDAP can throw some other kind of error code to indicate this policy. So basically, can LDAP enforce these policies and send the error code accordingly? Or this information has to me maintained in the application logic only using the database? Thanks in Advance, Anup
-
Hi All, I am working on Migration of Oracle Forms to ASP.NET, I am searching for approaches to make this happen, I have read about 'Forms2Net' tool which claims easy migration. But I want to know if it really works well, advice from somebody who has used Forms2Net or some other approach will be really useful. I would like to know following point on this: 1. Approaches for Migration of Oracle Forms to ASP.NET 2. Is Forms2Net really useful? Any shortcomings of Forms2Net? 3. What are the pitfalls or issues to watch out for while migrating? 4. Any aspects of the Oracle forms application that are better re-implemented than the migration approach? Waiting for your valuable responses. Thanks in Advance, Anup
-
Hi, I need to set the background image of the grid view cell according to the data. Is there any way to do this? Thanks, Anup
-
SelectSingleNode throwing exception: Hi, I have following XML which I need to modify and invoke a http request I need to select a node but I am getting "Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function." Error I am trying to access the <CUSTOMER/> tag with following code: requestXmlDocument.SelectSingleNode("/SOAP-ENV:Envelope/SOAP-ENV:Body/m:MT_MaterialSearchRequest/" + XmlNodeName.CUSTOMER).InnerText = some value; Please consider following tags before giving answer: • <SOAP-ENV:Envelope • <SOAP-ENV:Body • <m:MT_MaterialSearchRequest Following is the Xml: [highlight=xml] <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <m:MT_MaterialSearchRequest xmlns:m="http://br.eu/tl/v2"> <CUSTOMER/> <SALES_ORG/> <DISTR_CHAN/> <DIVISION/> <SEARCH_RESULT_SIZE/> <DEFAULT_SORTING/> <RESULT_TYPE>R</RESULT_TYPE> <REQ_DATE/> <REQ_QTY/> <SALES_UNIT/> <SEARCH_PARAM_IN> <AGG_SEARCH/> <COMMERCIAL_CODE/> <DESCRIPTION/> <WIDTH/> <SERIE/> <RIM/> <LOAD_INDEX/> <SPEED_SYMBOL/> <PATTERN/> <TUBE_TYPE/> <BRAND/> <HIERARCHY/> </SEARCH_PARAM_IN> <VISIBILITY_ITEM_IN> <ITEM> <ITM_NUMBER/> <MATERIAL idtype=""/> <REQ_QTY/> <SALES_UNIT/> <REQ_DATE/> </ITEM> </VISIBILITY_ITEM_IN> </m:MT_MaterialSearchRequest> </SOAP-ENV:Body> </SOAP-ENV:Envelope> [/highlight] I think I have to use XmlNamespaceManager, but I am not getting how do I use it in this case when there are following three tags in the xmldocument. • <SOAP-ENV:Envelope • <SOAP-ENV:Body • <m:MT_MaterialSearchRequest Thanks in advance, Anup
-
I need to write a query/stored procedure where I want to get a specific number for records (say 10) from the database according to the time they are inserted into DB. I store the insert time using SYSDATE and I want to retrieve the first ten inserted records (i.e. having smallest SYSDATE value) and then delete those from DB in one transaction. If my table looks something like this: RecordNum RecordType InsertTime 10 A 10/08/2007 14:20 20 B 10/08/2007 14:22 10/08/2007 14:27 � � � Please let me know how to go about it. Thanks, Anup
-
Hi Group, Can somebody tell me where I can find the internals of Logging application block 2.0/3.0. I need answers for the questions like: What best practices have followed in the implementation of logging application block? Is buffered writing is supported by this block? Does it write synchronously or asynchronously to the specified destination? Like, let�s say I am writing the log in the database then do I have to wait for completion of logging process or it is done asynchronously, so does my current thread do this for me or logging is handled by a separate thread? Any other benefits I get by using the logging application block? Why shouldn�t I for Log4Net of my own logger and use the enterprise library Logging Application Block? Any clue or even a link addressing these issues will be a great help Thanks, Anup
-
XmlDocument Vs StringBuilder
anup_daware replied to anup_daware's topic in Database / XML / Reporting
CreateDocumentFragment seem to be very useful :) Hi alreadyused and marble_eater, Thanks for the reply. I was not knowing about CreateDocumentFragment. I found it really useful and I may drop the idea of using a StringBuilder :) Regards, Anup Daware -
Hi Group, You might have found the Title a little strange :); well following is the problem description: I want to form a SOAP xml request to a servlet, I have my Request xml template ready. Now I have following options: Following is the sample xml template which I will use: <?xml version="1.0" encoding="UTF-8"?> <MT_MaterialSearchRequest> <!-- Customer Data --> <CUSTOMER> CUSTOMER _PLACEHOLDER</CUSTOMER> <SALES_ORG> SALES_ORG _ PLACEHOLDER </SALES_ORG> <!-- Limit on the size of the search result --> <DEFAULT_SORTING> DEFAULT_SORTING _PLACEHOLDER</DEFAULT_SORTING> <!-- Material Data --> <WIDTH> WIDTH _HOLDER</WIDTH> <SERIE> SERIE _HOLDER</SERIE> <!-- Material List --> <VISIBILITY_ITEM_IN> <ITEM> <!�NOTE: Number of <ITEM> nodes is dynamic> <MATERIAL></MATERIAL> </ITEM> <ITEM> <MATERIAL></MATERIAL> </ITEM> </VISIBILITY_ITEM_IN> </MT_MaterialSearchRequest> My Questions: Hoping to get some expert comments on this :) Thanks, Anup Daware
-
Solved :) Hi Group, The problem is solved :) Following lines were creating the problem: The the default buffer of StreamWriter is 4kb and the string responseXml is more than that, thus only a portion of my xml was being used by XmlTextWriter which is using responseStream: And that was the reason of Unexpected end of file while parsing Name has occurred exception. Solution: Rather than using the the StreamWriter, I directly used the responseStream.Write; for this I converted the string to byte array. Following is the code for it. Well the conclusion is StreamWriter has a default size of 4KB which is not increased dynamically, and this is really unexpected. Best Regards, Anup Daware
-
Hi Group, I am facing a strange problem here: I am trying to read xml response from a servlet using XmlTextWriter. I am able to read the read half of the xml and suddenly an exception: “Unexpected end of file while parsing Name has occurred” is being thrown. Following is the part o xml I am trying to read: <CHECK_ITEM_OUT> <ITEM id=""> <!-- id = [material] --> <ITM_NUMBER>1</ITM_NUMBER> <MATERIAL>001</MATERIAL> <DEALER_CODE>DEL_One</DEALER_CODE> <BRAND>Bridgestone</BRAND> <HIERARCHY>HAR001</HIERARCHY> <NET_PRICE>123.12</NET_PRICE> <CURRENCY>EURO</CURRENCY> </ITEM> <ITEM id=""> <!-- id = [material] --> <ITM_NUMBER>2</ITM_NUMBER> <MATERIAL>002</MATERIAL> <DEALER_CODE>DEL_Two</DEALER_CODE> <BRAND>Firestone</BRAND> <HIERARCHY>HAR002</HIERARCHY> <NET_PRICE>453.12</NET_PRICE> <CURRENCY>EURO</CURRENCY> </ITEM> <ITEM id=""> <!-- id = [material] --> <ITM_NUMBER>3</ITM_NUMBER> <MATERIAL>003</MATERIAL> <DEALER_CODE /> <BRAND>FIRESTONE</BRAND> <HIERARCHY>HAR001</HIERARCHY> <NET_PRICE>24.12</NET_PRICE> <CURRENCY>EURO</CURRENCY> </ITEM> </CHECK_ITEM_OUT> When I am trying to read the <BRAND>FIRESTONE</BRAND> (In Third item in the list), I am getting the “Unexpected end of file while parsing Name has occurred” exception. I am able to read the values from <BRAND> element for first two elements. Following is the code I am using for reading the xml. case "BRAND": if (!xmlTextReader.IsEmptyElement) productInfo.Brand = xmlTextReader.ReadElementContentAsString(); break; I also have searched net for this problem but I found nothing useful Please let me know if I am doing something wrong or missing on something. Thanks, Anup Daware
-
Confusion over Static class and Static method!
anup_daware replied to anup_daware's topic in General
Thanks Marble, it helped :) -
Confusion over Static class and Static method!
anup_daware replied to anup_daware's topic in General
Hi Marble, Thanks for the reply. It really helped :) -
Confusion over Static class and Static method! Hi Group, I have a little confusion over the use of static class in C#. I have a static method in my static class. This method reads an xml and returns a collection of objects. This collection of objects can be different for different users. This method uses some non-static variables which are local to this method. Following is my static class: public static class ResponseXmlParser { public static Hashtable GetProductInfoList() { XmlTextReader xmlTextReader; bool isScheduleElement = false; bool isResultItem = false; ProductInfo productInfo= new ProductInfo(); Hashtable productInfoList = new Hashtable(); try { //Create an instance of the XMLTextReader. //MaterialSearchResponse.xml is different for different users. xmlTextReader = new XmlTextReader("MaterialSearchResponse.xml"); // Process the XML file. while (xmlTextReader.Read()) { if(productInfo == null) productInfo = new ProductInfo(); if (xmlTextReader.NodeType == XmlNodeType.Element) { if (xmlTextReader.Name == "CHECK_SCHEDULE_EX") isScheduleElement = true; if (xmlTextReader.Name.Equals("CHECK_ITEM_OUT")) isResultItem = true; if (!isScheduleElement && isResultItem) { switch (xmlTextReader.Name) { case "ITM_NUMBER": if (!xmlTextReader.IsEmptyElement) productInfo.ItemNumber = xmlTextReader.ReadElementContentAsInt(); break; ... ... .. case "REQ_QTY": if (!xmlTextReader.IsEmptyElement) productInfo.RequestedQuantity = xmlTextReader.ReadElementContentAsInt(); if (productInfo != null) productInfoList.Add(productInfo.IPC, productInfo); productInfo = null; break; } } } }//END OF WHILE } catch (XmlException ex){} catch (Exception ex){} finally { if (xmlTextReader!= null) xmlTextReader.Close(); } return productInfoList; } } My doubts are: 1. Does a non-static local variable of static methods works fine in multi-user environment (Web Application) where method is expected to return different results? 2. Is there any other performance a benefit using the static methods except the non-requirement of creation of object of class in which method resides? Thanks, Anup Daware