Get Uploadify To Work With Cookieless Session State?
Jan 18, 2010
I have an uploadify control working fine in a vb.net web application - however whenever I switch on cookieless session state in web.config (cookieless="true") - it stops working.
In my upload IHttpHandler I can see that the data stored by uploadify is nothing:
Private Function Process(ByVal context As HttpContext) As String
Dim File As HttpPostedFile
File = context.Request.Files("filedata") ' Nothing
Dim FileExt As String = context.Request("fileExt") ' Nothing, etc
...
In ASP.NET, I'm a bit confused about role of cookies in session state. Whats is the difference between normal session state and cookieless session state?
Is it possible to use mixed cookieless sessions with cookie sessions? I've an application that captured user details and then redirect for payment to an ssl page. I was wondering if this is possible? [URL] redirects to [URL] Note: the session Id in the latter url. So in essence, we use the standard cookie session for the majority of the application but when we transfer to an ssl page we pass the SessionId to the https url to pick up the session. I've tried this locally but it starts a new session.
I just tried to implement Uploadify on my website using this guide: [URL].....
I followed every step of the guide, but when I try to access the page with the upload the following script runs, but the FileUpload stays a plain old FileUpload.
<script type = "text/javascript">     $(window).load(     function () {         $("#<%=FileUpload.ClientID %>").fileUpload({             'uploader': 'scripts/uploadify.swf',
i am still new to using session state, i want to convert page name into and integer according to a database table a function then compares "X" and "Y" to check if a user have the right to view this page i know this is not the best way of managing website security, but it is like "training on how to use the session" what have i done wrong
Partial Class advancedsearch Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Try Label1.Text = Session("username").ToString Label3.Text = Session("role").ToString Label4.Text = System.IO.Path.GetFileName(Request.Url.ToString()) Catch ex As Exception Response.Redirect("login.aspx") End Try If Label1.Text = "" Then Response.Redirect("login.aspx") End If Dim x As Integer = Int32.Parse(Label3.Text) Dim y As Integer = Int32.Parse(DropDownList1.SelectedItem.ToString) If x < y Then Response.Redirect("login.aspx") End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Response.Redirect("default.aspx") End Sub End Class
I would like to display a modal dialog using jQuery the first time a use browse my site. My fisrt idea is to check a variable in the session. So i do this:
[Code]....
In Google chrome and Firefox everything works fine but in IE it doesn't work.
Why this code doesn't work in IE?
What is the best way to display a model dialog the first time a user briwse a site in MVC2?
I have a situation that is need of attention.The following code is inside of a .ashx file, and is used in the Uploadify JQuery Script.(Here is a sample of the working IE/non-working FF,Chrome code)http://ee.cffcs.com/Q_Uploadify/1.zipThis file is never seen, it is only used behind.In IE you can upload images when you are logged in.In FF and Chrome you can only upload images when you are logged in with IE.(That is not right is it?)So, what is wrong, I know that the cookie script is functioning properly within the .ashx file, as I have test with another JQuery page and it works across all browsers, but when I use the cookie code in this, it acts wierd in FF and Chrome.Please someone enlighten me on this issue.What is going on with the cookie with Uploadify.
For a project (ASP.NET MVC 2 web application) we needed to use cookieless sessions. Furthermore, we use the ASP.NET State service, because the application is hosted on 21 web servers and we need to be able to share the session state. So the default InProc setting is not an option. Actually we enabled the ASP.NET State service on all of the web servers. The application's configuration file contains a custom configuration section which contains a list of the state servers. For example:
[Code]....
We created a class which descends from the sessionIdManager class. Our session id manager uses the session id generated by the base class and prefixes it with two numbers (00, 01, 02...etc). This number represents the index of one of the state servers displayed in the above list. We pseudo-randomly pick one of the state servers in order to balance the load accross the servers. Then we implemented the IPartitionResolver interface. Our resolver does the following:
Read our custom session idExtract the index which we appended (e.g. 01)Retrieve the information of the state server from the configuration file (192.168.0.102:42424) the state server information (IP & Port) is used to inform ASP.NET where the ASP.NET State server for this session is located. This setup works fine if we work with exactly one state server (e.g. development environment). It also works fine on our acceptance environment (2 state servers). But after we did a test by enabling 21 state servers and deploying the application on 21 web servers things went wrong. Sometimes the site would function correctly, but now and then we receive an 310 error. The browser informed us that the web page has resulted in too many redirects.
We created a new blank ASP.NET MVC site and implemented this custom session management and voila .... reproducable. Monitoring the traffic with Fiddler gave the following results:
A 302 status is returned containing the same location but a different session id: k heb met Fiddler de HTTP trafiek gemonitord en hetgeen ik tot hiertoe heb ontdekt, is dat er bij een request een status 302 wordt teruggeven met daarin dezelfde location maar andere sessionId.Voorbeeld
Response:HTTP/1.1 302 Found Server: ASP.NET Development Server/10.0.0.0 Date: Thu, 23 Dec 2010 09:11:31 GMT X-AspNet-Version: 4.0.30319 Location: /(S(17zprjcofc030gl3ph4lfqaklx))/ Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 150 Connection: Close <html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="/(S(17zprjcofc030gl3ph4lfqaklx))/">here</a>.</h2> </body></html>
this redirect keeps happening, each time with a different session id until a session id is generated that points to the web server which is also handling the ASP.NET request. Then the page will be shown.
Request: /(S(00cq1vtfyxsvfwxx2lply2zlma))/ Response: HTTP/1.1 302 Found Server: ASP.NET Development Server/10.0.0.
Date: Thu, 23 Dec 2010 09:13:13 GMT X-AspNet-Version: 4.0.30319
Location: /(S(00qbn3zut5mzek3fd4pq5pqt3a))/ Cache-Control: privat Content-Type: text/html; charset=utf-8 Content-Length: 150 Connection: Clos <html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="/(S(00qbn3zut5mzek3fd4pq5pqt3a))/">here</a>.</h2> </body></html> New request: /(S(00qbn3zut5mzek3fd4pq5pqt3a)) Response: TTP/1.1 200 OK Server: ASP.NET Development Server/10.0.0. Date: Thu, 23 Dec 2010 09:13:13 GMT X-AspNet-Version: 4.0.30319 X-AspNetMvc-Version: 2. Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 1365 Connection: Close
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL]TR/xhtml1/DTD/xhtml1-strict.dtd">
Is there some method in asp.net for getting an absolute url with cookieless session? UPDATE: I need create other new URL. It is not requested URL. I´m using Response.ApplyAppPathModifier for getting relative URL with cookie session.
I got the viewCustomer.aspx page sending parameter to EditBusiness.aspx page as per below coding .
After that i retrieved to EditBusiness.aspx.cs by using (Request.QueryString["customerId"] ) and save in session . Then i tried to use the session in the EditPersonal.aspx and EditOther.aspx is worked but then back to EditBusiness.aspx the customerId parameter is disappeared . I believe is because in EditBusiness.aspx.cs using string customerId = Request.QueryString["customerId"] . Even I have tried cookies but its doesnt work .
I've been working on this problem for some time without success. We have this website that has been working for many years now and we have been using cookieless sessions since the begining. Now we are integrating with another site to handle payment throught redirection. This provider ask for two adresses for success or failure of a payment so we have something like [URL] and [URL]. For design purpose thoses two pages do not exists and I use an httpModule to route to the proper page. I use httpApplication.Context.RewritePath to send to the proper page but I can never find back the session my user had before redirecting to the payment provider.
If I change the session mecanism to use cookies (cookieless="false" or cookieless="UseUri") with a few other tweaks, everything works fine Does anybody know if this has a chance to work? Is there a way to re-attach to an existing session?
I am developing a intranet site and want to track the users, I am using session for this purpose, I am using windows authentication mode so there is no login form here. When a user clicks the url for the first time a new session is created and at that time I am adding a entry in a table(say :Users) with username and logintime and sessionid etc. Below is the logic Iam using in form_load event of Default.aspx
If session("user") is nothing then ---create new session (at this point I am adding a entry in table(users)) Else --- use the same session and continue the work. End if
When I check the users info in the table some entries are created with same userid and same sessionids with different login time, how this is possible. I just want to know who is logged in and what time.
I have an ASP .NET website that uses cookieless sessions When the initial request is made to the site IE just displays the standard "Internet Explorer cannot display the webpage" message Firefox displays the following message: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. *This problem can sometimes be caused by disabling or refusing to accept cookies. The site works fine with my development server and under IIS6. If I switch off cookieless sessions then everything is fine
I have several ASP.NET sites, hosted on the same domain (different subdomains) and working via HTTPS. I have WCF service, hosted on the same domain. I have a separate state server for sessions.
All sites use cookieless session (if someone asks why - i will reply later, but it's a 'must')
On my sites, I use grid components from Telerik (but actually it does not matter) that ask for data from WCF service and must be filled with this data.
The problems are:
1) I cannot manage to make POST request to WCF service from javascript: for some reason it's always either GET or OPTIONS (no matter if I use Sys.Net.WebServiceProxy invoke or just a plain jquery AJAX request). It happens even if I indicate COOKIE mode, not cookieless. Maybe because of this I am getting "405 Method not allowed" error - WCF is set for POST request, but the site sends GET...
2) I cannot manage to retrieve SESSION from my websites! I tried approach, that I found, but WCF always uses OWN session, instead of 'connecting' to existing ASP.NET session, despite on ASP.NET compatibility mode. I need SESSION to exchange data between my sites and WCF service
3) I don't have idea currently, how to manage security when exchanging data between mentioned ones, in the light of above-mentioned problems...
4) I don't know exactly, how web.config for WCF service should look like in my case, because I've seen tons of different variants, but all for some simple cases.
Would be really appreciated for the help! I'm stuck for 2 or 3 weeks already, far behind the plan, but nothing still works... I can see there are some pieces of info about similar problems, but I'm afraid to miss some small thing - in web.config or method attribute or IIS setting, etc - and f... up everything.
Have not run the ASP.NET Development Server for a while. Today I copied a production website to my workstation and ran it with VS 2008. The following error message popped up. What is the problem with the ASP.NET development Server on my workstation? The website on the Production server still ran okay.Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of KEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesaspnet_stateParametersAllowRemoteConnection. If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.
I read the solutioin for this error, at the following link :http://forums.asp.net/p/1046935/1576341.aspxbut I am still not clear what exactly causes the error. I have two doubts :1. Can anyone please elaborate a bit on this issue, with any example ????2. Is there any drawback of this approach ?
When Session attribute Cookieless ="True" the page.Ispostback is always false.Cant understand the reason behind it.
And one more thing what is happening when we click Remember Me option in login control.As per my knowledge it is storing authentication cookie in it. If we can add data to authentication cookie then why we need session...we can add session data in that.. and authentication token is also regenerated for every new request like sessions.....i got confused after browsing for few hours.
Which one is more secure using cookies or URL for authentication and session.
Requirements: Create a Web Page in ASPx that will do the following:
1)One label will provide a count of how many times Button 1 has been clicked in the current session.
2)One label will provide a count of how many times Button 1 has been clicked by all users of the application. The Application Code for the Button should start at 100 (set this in the Global.asax file). this is what i have so far but i cant seem to get the application state to work properly.
aspx.vb
Partial Class _Default Inherits System.Web.UI.Page Dim clickcount As Integer
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("ClickCount") Is Nothing Then clickcount = 0 Else clickcount = CInt(Session("ClickCount")) End If If Not IsPostBack Then If Request.Cookies("UserName") IsNot Nothing Then Label1.Text = "Welcome Back " & Request.Cookies("UserName").Value & "." End If End If Dim clickCounta As Integer = CInt(Application("ClickCount")) End Sub Protected Sub PostBackSession_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles PostBackSession.Click clickcount += 1 lblClkCnt.Text = "Current Click Count is " & clickcount Application.Lock() Dim clickCounta As Integer = CInt(Application("ClickCount")) clickCounta += 1 Application("ClickCount") = clickCounta Application.UnLock() AppClick.Text = clickCounta Dim nameCookie As New HttpCookie("UserName", _ TextBox1.Text) nameCookie.Expires = Now.AddYears(1) Response.Cookies.Add(nameCookie) End Sub Protected Sub PostBackSession_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles PostBackSession.PreRender Session("ClickCount") = clickcount Application("ClickCount") = clickcount End Sub End Class global.asax <script runat="server"> Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Dim clickCounta As Integer = CInt(Application("ClickCount")) Application.Add("ClickCount", 0) End Sub Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) Dim clickCounta As Integer = CInt(HttpContext.Current.Application("ClickCount")) End Sub Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when an unhandled error occurs End Sub Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) End Sub Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) End Sub
Customer were getting "View State Validation Error" due to worker process recycling at our production webserver and to fix that i applied machinekey and then move my Session state Mode from In Proc to State Server to retain session data and not kick out the customer to relogin. I had serialization issue with one object which has to be stored in session but when i moved it out of session i could able to resolve the issue.
But doing all these i was partly successfull in keeping the user in their session when Worker Process recycle event occurs.I was able to refresh the page or make a post back by clicking the refresh button and also able to retain the session values. But the Problem occurs when sending asynchronous request to server which we do periodically every 15 minutes from the moment the user logs in.The web page doesnot update data on website when sending asynchronous request.By Debugging I found at this particular code point it fails to make a postback which is required.
<%=GetHintFromServer%> (When there is no Worker Process recycle i t gets replaced by WebForm_DoCallback('__Page',message,ShowHint,null,null,false) on postback) Everything works fine when there is no Worker Process Recyling but when it happens looks like sending request asynchronously using javascript fails .Remember When I make a post back by manually clicking submit button everything works fine.
I am new to .net 4.0 and am using EF Model and SessionState Mode=SqlServer and I am getting this error below:
Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.
I checked the stack trace and its complaining about
I marked it as serializable but then it complains about System.Data.Objects.ObjectContext is not marked as serializable and hence throws the same error.
Our ASP.NET App uses ASP State Session Management and has been rebuilt about 2 years ago [With .NET Framework 2.0]. We are currently in .NET framework 3.5 and have moved to SQL Server 2008 - but continue to use the same ASPState database. The State database has been upgraded to SQL Server 2008. Since then we have are seeing timouts/locks on ASPStateTempSessions table. I am wondering if we have to rebuild this database from scratch with some newer scripts?
I'm still debugging my application so it's on the local server. As I debug and stop then debug again, eventually lblNoOfUsers.text turns to "0" instead of "1", even as I'm navigating my application. It only turns to "1" again if I log out and sign back in. It's almost as though Membership.GetNumberOfUsersOnline my login are referencing two different session states. How is this possible? Does asp.net create a new session state cookie each time I start debugging?