Advertisements
RSS

Tag Archives: .Net

JavaScript: Cookies


A cookie is a variable that is stored on the user’s computer. You can use Javascript to create and retrieve cookie values.

To create a cookie:


function setCookie(sCookieName, sCookieValue)
{
var oCookieExpiryDate = null;
try
{
oCookieExpiryDate = new Date();
if (oCookieExpiryDate == null)
{
return -1;
}
oExpiryDate.setTime(oCookieExpiryDate.getTime() + (1000 * 60 * 60 * 24 * 30)); //30 days
document.cookie = sCookieName + "=" + sCookieValue + "; path=/" + ((oCookieExpiryDate == null) ? "" : "; expires=" + oCookieExpiryDate.toGMTString());
}
catch(e)
{
}
finally
{
}
}

To get the value of a cookie:


function getCookie (sCookieName)
{
try
{
var sCookieNameEQ = sCookieName + "=";
var oCookiesArray = document.cookie.split(';');
for(var i=0;i < oCookiesArray.length;i++)
{
var oCookieItem = oCookiesArray[i];
while (oCookiesArray.charAt(0)==' ')
{
oCookieItem = oCookieItem.substring(1,oCookieItem.length);
}
if (oCookieItem.indexOf(sCookieNameEQ) == 0)
{
return oCookieItem.substring(sCookieNameEQ.length,oCookieItem.length);
}
}
return null;
}
catch(e)
{
}
finally
{
}
}

 

Advertisements
 
Leave a comment

Posted by on October 10, 2012 in Programming

 

Tags: , , , , , , , , , , , ,

Using ASP.NET Mobile Forms

I wanted to use the normal ASP.NET Forms stuff in a mobile form.

  • Right click on the web site project and select Add new Item

1

  • Select Mobile Web Form. enter a name for the form and click on Add button

2

  • To use a style sheet & a JavaScript file, I added a DeviceSpecific with SupportJavaScript Filter. this is how the HTML code looks like

3 

  • Now I wanted to created some ASP controls. so I added another DeviceSpecific with isHTML32 Filter. this is how the HTML code looks like

4

 

  • One last thing, in order to make those DeviceSpecific Filters to work you need to add the required keys in the web.config file. this is how this would look like

untitled

 
2 Comments

Posted by on February 5, 2010 in Programming

 

Tags: , , , , , , , , , , , , , , ,

GridView: Wrong Fields Order

 

I was working on a GridView that is binding to a custom class collection to display its properties. the fields in the GridView were ordered depending on the order of the properties in the Class. everything was working fine. until I moved the code to a different development environment.

In the new development environment the order of the GridView fields was not as expected. after spending a lot of time trying to fix that. I installed the .NET 2.0 service pack 2 and that solved the problem!!!!

You can download the .NET 2.0 SP2 from here

http://www.microsoft.com/downloads/details.aspx?familyid=5B2C0358-915B-4EB5-9B1D-10E506DA9D0F&displaylang=en

 
Leave a comment

Posted by on January 27, 2010 in Programming

 

Tags: , , , , , , ,

Retrieve C# code out of EXE Assembly

I lost some of my applications code coz of PC format, one of these applications is a C# Console Application, I managed to get the exe output of this application but I was not able to retrieve the code files so I used (.NET Reflector) to do this:

 

1-     Download the .NET Reflector.

 

2-     Download the Reflector.FileDisassembler.

 

3-     Extract the .Net Reflector

 

4-     Extract the Reflecter.FileDisaembler

 

5-     Copy the Reflector.FileDisassembler.dll to the .Net Relector Folder

 

6-     Start Relector.EXE

 

7-     From the View menu select Add-Ins

 

 

8-     In the Add-Ins Screen select Add and select Reflector.FileDisassembler.dll then close the Add-Ins screen

 

 

9-     From File menu select Open and select the exe file you want to retrieve its code

 

 

10- The reflector will load the file Assembly in the Assemblies section

 

 

11- Select the required file and from the Tools menu select File Disassembler

 

null

 

12- Click Generate and you will get your code

 

null

 

 Finally I would like to thank Siderite for his help

 
20 Comments

Posted by on July 31, 2008 in General, Photography

 

Tags: , , , , , ,

 
%d bloggers like this: