Showing posts with label session. Show all posts
Showing posts with label session. Show all posts

Wednesday, March 28, 2012

ATLAS with Session

Hi, got a question about how atlas handle the serverside session?After user login, I put the user information into a session.

then, in the UI, there is a client javascript event calling the backend web service, and the web service needs to access the user information from session,

but it seems HttpContext.Current.Session is always null value..

understand, ajax actually initiate a new connection via xml http to the server, but can they access the session variable?

Make sure you enable session state in your Web Service:

[WebMethod(true,EnableSession=true)]
publicstring GetMessages(string ChatId,string Username)
{

}

+++ Rick --

Monday, March 26, 2012

Atlas Unknown Error Popup on Session Exipry - Requesting fix

Hi,

I did some invesitgation on the"Unknown Error" javascript popup and it does happen when the session expires and the user performs an operation on the page. I am not able to get rid of this problem, eventhough the code checks for session expiry. The page doesn't load in the first place to call the function given below. Instead the unknown error popup appears . We are looking for a fix as soon as possible as we are going live next month . This is critical as almost all the web pages in the application is using atlas updatepanel. Can anyone please provide a solution to this problem.

Thanks in Advance,

Vikram

Session Expiry Server Side Code:

privatevoid CheckSessionExpiry()

{

string appPath = Request.ApplicationPath;if (appPath !="/")

appPath = appPath +

ConfigurationManager.AppSettings["SessionExpiryPage"];else

appPath =

ConfigurationManager.AppSettings["SessionExpiryPage"];string headerval =Convert.ToString((Session.Timeout * 60) - 45) +";URL=" + appPath;Response.AppendHeader("Refresh", headerval);if (Session["sUserID"] ==null)

{

Response.Redirect(appPath);

}

}

Unfortunately, there's no adequate solution. I'm facing the problem myself and I wonder when it's going to be fixed. You can browse through the forum to see I'm right.
If you are using other Java-Script functions on your page, I have found it matters if you have your SCRIPT tag with language=javascript or language="javascript" and if it is the HEAD of your HTML or in the BODY of your HTML.

If in the HEAD of your HTML, I have found that you need to have the double quotes [ language="javascript" ]

If in the BODY of your HTML, double quotes do not seem to matter, with or with out double quotes seems to work just fine.

For more detail:
http://jblack.wordpress.com/2006/08/18/javascript-or-javascript/

Hi,

Thanks for your reply. But unfortunately I do have language="javascript" . So what else could be the problem .

We use simple javascripts for doing some client side validations. Could they sometimes cause atlas to give raise to unknown error problem ?

Example 1:btnCompareBenefits.Attributes.Add("onclick", "return CompareClick();"); CompareClick function is in a .js file.

Example 2:deleteButton.Attributes.Add("onclick", "return confirm (\"Are you sure you want to Delete? \");");

Thanks in Advance,

Vikram


Hi All,

I am also experiencing an issue where I get unknown error.

My issue only happens when I wrap asp.net 2.0 controls in an update panel. The strangest thing is that this is only happening in one of two projects that uses the same ASP.net controls. In one I get the updates working fine in the other I get unknown error. The only difference as I can see is that n the project that doesn't work correctly the controlls are nested more deeply. I have a panel surrounding a header and body panel, giving the appearance of a window and the update panel is inside the body panel so the controls are 3 panels deep in design mode. In the project where it all works the controls are one panel deep only as they are inside an update panel only.

I have tried th javascript "javascript" fix as well and the ampersand fix and validaterequest="false" in the page tag... none work, the only way to stop the error is to avoid placing any asp.net control inside an update panel.. Then I get a postback :0(

This issue is crippling us at the moment.


My issue was totally the reverse! I have an ScriptManager on my masterpage. The "Unknown Error" popup was occuring on a page with no UpdatePanel. When I wrapped the asp.net 2 control on the page in an UpdatePanel the popup went away.

Bump.

I am also having this problem


I had this issue as well. I did find an acceptable work arround. Create and<ErrorTemplate> section within the ScriptManager tag. This will eliminate the JavaScript popup alert. Then you can have a firendly erro message asking the user to relogin and provide a link to the login page. Something like this:

<atlas:ScriptManagerID="ScriptManager1"EnablePartialRendering="true"OnPageError="Page_ErrorHandler"runat="server">
<ErrorTemplate>
<divclass="ErrorDialog">
<div>
<asp:ImageID="Image1"ImageUrl="~/images/error.gif"ImageAlign="AbsMiddle"runat="server"/>
<spanstyle="font-size: 16pt; font-weight: bolder;">Server Error</span>
</div>
<div>
You encountered an unexpected error. The error has been logged and will be investigated.
</div>
<div>
<ahref="login.aspx">click here to re-login.</a>
</div>
</div>
</ErrorTemplate>
</atlas:ScriptManager>

See ErrorTemplate doc for more info:http://atlas.asp.net/docs/Server/Microsoft.Web.UI/ScriptManager/P_ErrorTemplate.aspx

Hope this helps,
Perry


Remove lineResponse.AppendHeader("Refresh", headerval); & try again with correct session timeout methods.

remove any response.write statements & replace them with this.page.clientscript.registerclientscriptblock();

we have no problems with session timeout.Updatepanel works even if session is expired

Amit Lohogaonkar

mcp,mcad

lohogaonkaramit@.yahoo.com


Hi,
I have found this problem several times. finally I was able to corner it in my case.
I was using several UpdatePanels on my page and have few javascript functions within SCript tag in HEAD section of page.
It is important to note that whnever javascript function contains "postfix increment operator" i.e ++ or "postfix decrement operator" i.e. --, it will throw "Unknown Error".

Similarly whenever javascript function contains "logical AND operator " i.e. && "logical OR operator" i.e. ||, it throws the "Unknown Error".
However, if these functions are inside "BODY" tag then it works just great. Or if they are moved to a separate JS file and then include it in HEAD tag, it all works fine.

Hope this helps.
Mayur


Hi

still face same problem,

Regards,

Sarfaraj Sayyad


I'm guessing you guys are using ASP.NET Forms Auth - and the login cookie is expiring.

From what I can tell, ASP.NET Ajax throws an "Unknown Error" when it makes a XmlHttp call and gets a response which isn't what it was expecting.

In the case of a session expiry, instead of the page fragment it was expecting it suddenly gets back a "You need to login" page, or a 500 error, or a 404.

It doesn't know what to do, and dies with an "Unknown Error".

I'm going to try out that ErrorTemplate example pasted in one of the replies above and see if that does it for me.


I'm also getting the same 'Unknown error' alert when the session expires. Without Atlas on the page there is no problem. I can trap errors and modify the ErrorMessages of other page errors with with the 'OnPageError' event of the script manager but it won't trap the 'Unknown error'. I assume this is because the server code is not executed as Atlas is not able to deal with the expired session. My page continues after the alert and renews the session but I would like to avoid this error or at least be able to modify it.
I've discovered since my last post that the "Unknown error" only occurrs when the new session trys to redirect to a different page. In my app when the session starts it checks certain conditions and may redirect. If there is no redirect it renews the session without error.

I'm facing the same problem.

As I'm not using any other client side javascript than the one built in the atlas controls I can eliminate script specific error reasons.

Wednesday, March 21, 2012

Atlas Session Timeout/Expires

I have a secured area of my website that uses Forms authentication that I am trying to integrate Atlas into. The problem that I am having is that whenever my session expires and I try to do something that is within an UpdatePanel, it won't bounce me back to the login page. The remote request executes and the XMLHttp response back to my browser is the login page, but the client side components of Atlas don't know what to do with it?

Any ideas?

Jonathan

Hello Jonathan,

We will take a look and I will post a follow-up. Thanks for the info.


Same problem... Would really like a solutions...

Thanks for the feedback. We are working on a solution for a future release.


I have a solution, though not pretty...

Add a Meta Refresh for one second longer than your session timeout. This way the global refresh will redirect to the login page if the session times out. The Atlas postbacks will keep the session alive, so if the session is valid, the user will see a page refresh. Make sure you save state in session vars so you can return to the same point they were at.

-Jesse
Any update on this? We're also running into the same problem.

Thanks!

Jonas


The partial page rendering work from the last CTP release has undergone some revisiting and now handles this better. It will be available in our next release. The exact date for that is not yet nailed down, probably late September or early October.
What about for Webservice calls? Will there be a way to detect a session timeout/forms auth timeout there?

Jonas


Could anyone tell how it is finally done in the Release version?

Atlas session issue

Hi all ,

i am working of a hospital management system which we desided to develop using atlas frame work. we have created the application main to sections using atlas script call back architecture. we are using scripts to pack the user entered data to the web service and in that web service we are entering the data in to the database.

all this happening with out a post back of the page.

now comes the problem.

we are not being able to handle the user session properties. we came to know that we cant access session variables in web services.

we are in a trap now. how we can manage the session, validity and time out of a user. cose in this method there is no method to handle the time out.

we also want to share some data between pages all along the use session. how can i acheive this.

can any one help in this regard.

Hi,

If I understood your issues corretly then this may give you soluiton.

When you use session in the web service you have to set enable session property to true in the webmethod attribute

Regards,

Techwork


Hi Techwork :)

We are calling the web service functions from java script using atlas frame work, Can i access a particular session like this " setting enable session property to true "