Transferring session content between ASP and ASP.NET
March 27, 2008
recently I had to integrate two applications one built in ASP classic and the other was an ASP.NET application, a problem you might have is transferring the session content between the two applications, you will have to do a workaround to get it done, the following sample illustrates how:
the ASP classic part
where your session variables are set, and where you want to do the transit between the two application, drop the following code into two ASP classic files, the first one is where you set the session variables, and want to transit to the ASP.NET application, the second ASP classic page submits the compound session content to the receiving ASP.NET page:
<TITLE>ASPPage1.asp</TITLE>
<%
‘ This is the page where we just set the ASP Classic Session Variables
Session(“username”)=”waleed”
session(“email”)=”email@gmail.com”
Server.Transfer(“ASPPage2.asp”)
%>
===================================================
<TITLE>ASPPage2.asp</TITLE>
<%
‘ We pull all the session variable names/values and stick them in a form
‘ and then we submit the form to our receiving ASP.NET page (ASPNETPage.aspx)
Response.Write(“<form name=t id=t action=ASPNETPage.aspx method=post >”)
For each Item in Session.Contents
Response.Write(“<input type=hidden name=” & Item)
Response.Write( ” value=” & Session.Contents(item) & ” >”)
next
Response.Write(“</form>”)
Response.Write(“<script>t.submit();</script>”)
%>
the ASP.NET part
this is where you would receive and set the ASP.NET session variables.
<TITLE>ASPNETPage.aspx</TITLE>
<%@ Page language=”c#” %>
<script runat=server>
private void Page_Load(object sender, System.EventArgs e)
{
for(int i=0;i<Request.Form.Count;i++)
{
Session[Request.Form.GetKey(i)]=Request.Form[i].ToString();
}
//where you will start your ASP.NET application
Server.Transfer(“YourASPNETApp.aspx”,true);
}
</script>
AJAX, the wrong tool?
March 13, 2008
Some developers view AJAX as the best view for every scenario, however from my own experience AJAX introduces its own set of drawbacks, and we should take care before we start on using this technology, we can summarize these drawbacks in the following points:
Additional development time
Learning a new technology like AJAX makes its own delays before properly understanding and using it.
An extra time would be needed when we consider what to do when a user has disabled JavaScript support within their browser, this would require additional development time to deliver an alternative solution (using the NOSCRIPT tag).
No browsing history, means Back/Forward buttons become useless, so the users are unable to easily bookmark or navigate to and from the app. using the browser’s buttons, there are some JavaScript libraries provide a way to build such functionality, but it will add development time and testing.
In addition, when developers jump on the AJAX, you should make sure they don’t use it for everything, so you won’t lose time fixing the application up eventually.
Accessibility
AJAX makes the browsers act in a way that is different than its original design, like we said, Back and Forward buttons no longer work as expected, and there is no URL for some AJAX content, you will have to take all this into your consideration while designing your AJAX application.
Discoverability
Search engines like Google requires a page URL and use words on the page as one of the aspects of its approach to ranking pages. search engine spiders do not load a page and execute its JavaScript, this can lead to lose visitors, but it will not be an issue for internal intranet applications.
Security
while JavaScript is a mature language, it does have security holes that must be considered regardless of whether you’re using AJAX, sever-based security measures can be used to block such problems.
also the issue of cross-site scripting (XSS) is more recognized with AJAX, as script may run in the background and access resources without user knowledge, given these possibilities, all data must be protected to avoid malicious activity.
and finally, make the good decision
All have agreed a hybrid approach is usually the best solution with AJAX, there are times when AJAX is applicable, and there are times when you should use another approach.
what problems have you encountered during developing AJAX-based application? share your experience..
EDC ‘08 and Patrick Hynds
March 12, 2008
After a couple of delays, next month the EDC (Egyptian Developer Conference) ‘08 will take place in Cairo, nothing has been announced yet about the agenda, place, speakers and topics, all we’ve got is “the mid of April”.
Patrick Hynds (MDC’s most famous speaker) has just confirmed his participation and announced the topics he will be speaking about in the conference.
see you all there!
Career Options day at FCIS
March 8, 2008
today I was in the FCIS-Ainshams – the school where I graduated in, and doing my post-graduate – and I had the good chance to attend an event organized by the ACM called “Career Options”, it shows the students especially who are in their last year, what career paths they are going to have.
when I was first looking into the event agenda, I thought the academic career path session would be just a misery, because in real life the academic career path is the worst thing to go for as a FCIS graduate – at least in the first ten years – but it ends up being the best session in the event! and here is how.
Abdalla Gamal did a great presentation about it for the students, it was very inspiring for everyone, making a good thing out of a not good enough thing to go for – due to the research infrastructure we currently have in Egypt – I’ve blogged about this before in the research disaster around, check it out to see where exactly is the point.
the presentation was just great, the only comment here is, it didn’t answer what’s next question, okay I’m excited what’s next?, Abdalla was talking about the research and how to, but his presentation didn’t answer what concerns the students, what they have to do now to be engaged to this path, and are there any chances for them other than FCIS to start with? in my opinion this would just close the circle he has opened in his session.
you can download Abdalla’s presentation from here
the event was just great, great effort by all the ACMers and well done!
I am posting this to help you and myself on remembering and getting these three actions done with any ASP.NET 2.0 application that uses Membership Provider before pushing it into a production server:
1. Add “applicationname” attribute in Profile Provider. IF you do not add a specific name here, Profile provider will use a GUID. So, on your local machine you will have one GUID and on production server you will have another GUID. If you copy your local DB to production server, you won’t be able to reuse the records available in your local DB and ASP.NET will create a new application on production. Here’s where you need to add it:
- <profile enabled=”true”>
<providers>
<clear />
<add name=”…” type=”System.Web.Profile.SqlProfileProvider” connectionStringName=”…” applicationName=”YourApplicationName” description=”…” />
</providers>
2. Profile provider will automatically save the profile whenever a page request completes. So, this might result in unnecessary UPDATE on your DB which has significant performance penalty. So, turn off automatic save and do it explicitly from your code using Profile.Save();
<profile enabled=”true” automaticSaveEnabled=”false” >
3. Role Manager always queries database in order to get the user roles. This has significant performance penalty. You can avoid this by letting Role Manager cache role information on cookie. But this will work for users who do not have a lot of roles assigned to them which exceeds the 2 KB limit of Cookie. But it’s not a common scenario. So, you can safely store role info on cookie and save one DB roundtrip on every request to .aspx and .asmx.
<roleManager enabled=”true” cacheRolesInCookie=”true” >
that depends on several factors. One of the most important factors is the planned number of visas to be given out at a visa office (target numbers) for the year. The assignment of these target numbers to each Canadian visa office around the world is among the most significant annual decisions undertaken by Citizenship and Immigration Canada. 2008 targets have just come out.
Citizenship and Immigration Canada (CIC) publishes estimated processing times based on the past performance of each visa office; they are historical estimates and therefore do not always reflect future performance.
Announced last November, Canada’s immigration plan for 2008 is to welcome somewhere between 240,000 and 265,000 new Canadian Permanent Residents.
see the estimated processing time for all visa offices here



