ASP.NET Random string showing up in URL - c#

I am developing website using Asp.Net 4.5 (VS2012) and using Telerik Ajax controls. I am using Telerik Schedular, Grid, AjaxPanel etc.
Project compiles fine. When I run it from VS.. It is showing me URL like this
http://localhost:23482/default.aspx
and then suddenly some random string inserted between URL. and it looks little wired like below
"http://localhost:23482/(S(hchi1ir5xii2dy1cjgpghqx3))/default.aspx"
"http://localhost:23482/(S(mgxsfl3rnxnbx2y24i12nowe))/default.aspx"
"http://localhost:23482/(S(sc2hyowh0f2xidnx1zptgaqd))/default.aspx"
I've also tried to run it from IIS as website. no luck.. same problem.
NOTE: The website still works fine even with random strings in URL nothing is broken at all.
Can anyone please suggest me something ?|
Thanks

Seems like you are using cookieless session
See this

SessionId by default is store in cookies but you can use cookieless session by writting this lines to web.config
<system.web>
<sessionState cookieless="true"
/>
</system.web>
you can remove that lines from webconfig to remove (S(hchi1ir5xii2dy1cjgpghqx3))
from
"http://localhost:23482/(S(hchi1ir5xii2dy1cjgpghqx3))/default.aspx"
or write to web.config
<system.web>
<sessionState cookieless="false"
/>
</system.web>

Related

Removing ASP.NET_SessionId from an ASP.NET application

I am changing session state in:
<sessionState cookieName="myCookieName" />
It changed correctly, but one issue I am facing is default the "ASP.NET_SessionId" is also showing.
I didn't understand what I am going wrong. How can I fix this?
<system.web>
<sessionState cookieName="foo" />
</system.web>
I need only to show a cookie named foo. I don't want to show "ASP.NET_SessionId".
Maybe it's just a cache issue. Try to delete the cookie in the browser.
Then log in again, and see if it appears again...

Random Invalid Viewstate Error

I know there are a lot of questions on this topic and I have read them all.
I'm using IIS8, .Net 4.5.
Users randomly get an invalid viewstate error, I can't figure it out. Once this happens the only way they can get back into the site is to clear browser cache.
In my web.config I have:
<system.web>
<machineKey validationKey='....key here' decryptionKey='....decrypt key is valid here' validation='SHA1'/>
<!--<hostingEnvironment shadowCopyBinAssemblies="false" />-->
<authentication mode="None" />
<compilation targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
...
</system.web>
I'm running on a virtual private server, and I've yet to find a viewstate larger than 9kb.
My application pool is set to restart at 3:00am, once per day.
My page uses update panels, maybe the user is clicking 'back'? But I've seen it happen just visiting the page with no clicking back.
One thing I noticed is I have 3 different sites using the same application pool identity, but the application pools are seperate. There is no machine keys in machine.xml, but only in my web.config.
A couple of possibilities to investigate:
Update panels are changing form field values (which are what is used to compute ViewState), then the page gets POSTed back to the server, where the new values make validation fail. See this post
You have caching enabled (perform a trace of HTTP headers - make sure you don't have dev tools open) which is causing invalid ViewState to be generated w/ UpdatePanel gumming things up.
Are you using Server.Execute anywhere? (see above link for same)
(less likely) Does your "Virtual Private Server" get migrated to different hardware (perhaps without you knowing it)?

#gets appended at the end of url on clicking rad tab

I have uploaded my application to live server published code into iis my tab doesn't works on live,tab gets post back on the local, # gets appended automatically at the end of the url unable to postback on the server which causes the postback working to stop.
Look for JavaScript errors on your page. If there are, the tab will not be able to execute its JS logic, so it will act as an ordinary anchor and add the hash to the URL.
It is often the case that webresources do not load on your production server because of permissions. Check these two articles for more info on troubleshooting that:
http://www.telerik.com/help/aspnet-ajax/introduction-troubleshooting.html
http://www.telerik.com/help/aspnet-ajax/introduction-web-resources-troubleshooting.html
You will, most likely, need to let your user access webresource:
<location path="Telerik.Web.UI.WebResource.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
Also, you can try using the CDN to avoid loading resources from your server: http://www.telerik.com/help/aspnet-ajax/scriptmanager-cdn-support.html. If you have it enabled already, then you may not have connection to the cloud where the scrips come from, so you can consider disabling it.

asp.net Session timeout issue

got a problem with my asp.net mvc project timing out after only a couple of minutes. It's especially annoying because I've got quite a complex upload and import procedure which falls over when i get logged out. I currently use asp.net membership provider for authentication.
I've tried a few things that I've seen on this site and others but to no avail. Here is what I have so far in the web config:
<location path="Admin/Upload">
<system.web>
<httpRuntime executionTimeout="1200"/>
</system.web>
</location>
<system.web>
<sessionState mode="InProc" timeout="20" cookieless="false" />
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="20" />
</authentication>
<add name="ConnectionString" providerName="System.Data.SqlClient" connectionString="Server=SERVERNAME;Database=DBNAME;User Id=USER;Password=PASSWORD;timeout=30;MultipleActiveResultSets=True" />
I was sure it was only a minute before being timed out before I added the sessionstate timeout, then it was upped to 2 mins, but can't be 100%.
I thought about using this:
<lifetime leaseTime="15M"/>
...but not 100% sure how to implement it - anyone had any success with it, or know something else I could try?
Thanks
EDIT: I'm on a cloud hosting solution, but only have a control panel - no access to IIS
UPDATE: I've now tried adding lifetime leasetime and it's not made any difference:
<system.runtime.remoting>
<application>
<lifetime leaseTime="20M" />
</application>
</system.runtime.remoting>
</configuration>
UPDATE 2:
Ok, I've edited the title and the web config values to reflect my latest effort, but I'm still struggling. I spoke to the hosting company who set the connection timeout to 20 minutes. However, it the session ends after 10 mins. Is there anything else I can try?
I'm getting there, but I would like 20 minutes!
The lifetime leasetime tag goes in the application tag.
<application>
<lifetime leasetime = "15M"/>
I've never actually used it but if it is like other timeouts idk if you will need the M at the end. That is pure speculation though. You should also be able to set it to "0" so that its lifetime is "forever"
As for the session timeout that looks like it should be set for 100 minutes. However, it should be inside of your <configuration> tags
EDIT
Completely unrelated to the question kind of. But i like how your runtime execution timeout is "over 9000"
Right, I got a solution to this, but it wasn't what I was expecting.
It turned out I was using the aspnet Membership Provider wrongly. I was using like a previous membership system I worked on and logging in then setting the UserId as a session variable and using that throughout the site. I then discovered that is the incorrect way to use it, and changed it to a combination of User.Identity.IsAuthenticated and Membership.GetUser().ProviderUserKey.
It no longer times out and all is well. Thanks anyway.

Disable Caching For A Single JS File Using Web.config

I currently cache everything possible on my site (images, JS, CSS). There is only one JS file that I need to be loaded fresh every single time. How do I omit just one file from caching, using web.config, whilst leaving everything else cached?
Note that I tried another link here, and it didn't seem to stop the caching of my file:
How do I disable caching of an individual file in IIS 7 using weserver config settings
How about:
<configuration>
<location path="path/to/the/file.js">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
</system.webServer>
</location>
</configuration>
(Note that the path is relative to the web.config file)
I don't think you can do it using web.config, but you could add a unique querystring parameter to the javascript url in order for it to be loaded every time:
If you are using ASP.NET
<script src="mycode.js?<%=System.Guid.NewGuid.ToString()%>"></script>
Set the path for it not as a static URL but get an ASPX page to serve the script. Inside your ASPX page just send back the text:
byte[] javascriptTextBuffer = GetMyJavascript();
Response.ContentType = "text/javascript";
Response.Write(javascriptTextBuffer);
Inside the page turn off caching.
Having said that, it seems to me that you are doing something wrong that have to load the JavaScript file everytime. Make scripts static but use parameters to drive versatility.

Categories

Resources