Session State - multiple browsers - asp.net

What is the best way to keep session state between browser tabs?
I have the following scenario. I have a page where the user opens a 'project' from a grid.
I keep this project in the session as the "Current Open project".
The problem is that users can open another project from another tab in the browser. Now, they open another project and this becomes the new "Current Open project".
If they go back to the first page ... it is clearly a problem.
Is there a way to solve this situation please?
Thanks,
Joseph

No, you just have to handle it.
When a page tries to do something with a project, the server has to check if it's the current project that the page is trying to change or a different project, so that the server can send an error message back that the wrong project is opened.
Alternatively you can avoid keeping the current project in the session, and allow multiple projects to be opened simultaneously. As long as each page keeps track of which project it is handling (which you have to do anyway), it's not a problem.

Related

Is it possible to resolve a DCOM Interactive User permission error, when using DCOM with IIS and .aspx pages displaying data from a database?

There are a number of similar-sounding questions to this, but none of them quite address this specific question.
https://social.technet.microsoft.com/Forums/systemcenter/en-US/dfc465bc-7bbd-483e-b98b-2ba56fa98313/the-applicationspecific-permission-settings-do-not-grant-local-launch-permission-for-the-com-server?forum=configmgrgeneral
https://social.technet.microsoft.com/Forums/windowsserver/en-US/353d381d-0911-41c3-98fb-2475b65c32f6/dcom-was-unable-to-communicate-with-the-computer-xxxx-using-any-of-the-configured-protocols?forum=winservergen
https://social.technet.microsoft.com/Forums/windows/en-US/4aa643b6-f90d-4672-aba4-6c0a290e22d4/distributedcom-permissions?forum=win10itprosecurity
https://social.technet.microsoft.com/wiki/contents/articles/17914.fim-troubleshooting-event-id-10016-the-application-specific-permission-settings-do-not-grant-local-activation-permission-for-the-com-server-application.aspx
DCOM/IIS Issues
https://www.automation.com/pdf_articles/Troubleshooting_OPC_and_DCOM.pdf
I'm sure there are many other pages that are similar to this, but I'll stop here.
The scenario is this:
Windows 10...
...hosting an application (or cluster of applications) that takes near-real-time data from real sensors parses the numbers, writes them to a database, and presents them onto a browser .aspx page via IIS and DCOM
(this is an archaic mysterious application/set of applications for which there is limited or no source code or documentation).
Occasionally, after working through all the installation and configuration steps, you are presented with a localhost/something.aspx page and whilst you can see the variables by hovering over the fields, the values are not populated.
Looking in Windows event viewer, you may see errors like this:
Event ID 10016 - The application-specific permission settings do not grant Local Activation permission for the COM Server application
The application-specific permission settings do not grant Local Launch permission for the COM Server application with CLSID{...long hex number found in registry ...}
i.e.:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID{8D8B8E30-C451-421B-8553-D2976AFA648C}
There are two more keys, but I don't have them on this PC that I'm typing on; one is an installed component for handling DCOM, and another one is to do with the Interactive User as well.
The installed one, is usually the one that reports having no permissions, typically for the "NT AUTHORITY\NETWORK SERVICE SID (S-1-5-20)" user (formed into a group of admin and user accounts)
[https://www.experts-exchange.com/questions/24205909/NT-AUTHORITY-NETWORK-SERVICE-SID-S-1-5-20-on-Windows-Server-2003.html... can't access this page at the moment]; then when you go into the security and add specific permissions for it, you're left with it reporting the above Interactive User keys, the 8d8... one and a 726... one, which you can't edit permissions for.
What bugs me about this is that it's apparently a complete magical mystery, which is unacceptable in a computer system! :D
The current solution is to just no bother fiddling, and just format the machine, redo windows, work through all the application installation, IIS, and DCOM steps, and .aspx config again from scratch, and hope for the best - i.e.: that the magical special order that you do things in just makes it work, "because it does". I think this is a bit ridiculous, and time-consuming, more to the point, it bugs me intensely that there's not really a clear notion of what the actual problem is and what the solution might be.
There must be something specific happening or not happening that is causing the DCOM to not talk to the .aspx webpage; surely something that can be tweaked after the event without zapping the whole systems and spending ages redoing it all. It's as if something is "unplugged" or has a different identity/name/number from what is being looked at or filtered by what the .aspx page ingests, maybe something in the code? something in the IIS selections? something that needs resetting? Not sure...
I'm not asking for a silver bullet, but if anyone is willing to help work through this, that would be appreciated, it's just annoying and frustrating, and I'd like to get to the bottom of it, and hopefully create a definitive thread that others might benefit from.
Before going into these lengthy procedures and editing registry. I would you look at TCP/IPv6 in the Local Area Connection Settings. If it is enabled then disable it and flush the dns or restart your server. Hope it helps the future seekers.
Stay blessed everyone..
This appears to be the exact same issue 4 years ago.
https://answers.microsoft.com/en-us/windows/forum/windows8_1-winapps/weather-application/e4630db3-50c2-4cc5-9813-f089494a1145
Hi
Not sure if this will fix your issue but I was able to fix mine.
Open Regedit.
Go to HKEY_Classes_Root\CLSID*CLSID*.
Note: CLSID stand for the ID that appears in your event viewer error. In your case, it's {C2F03A33-21F5-47FA-B4BB-156362A2F239}.
Right click on it then select permission.
Click Advance and change the owner to administrator. Also click the box that will appear below the owner line.
Apply full control.
Close the tab then go to HKEY_LocalMachine\Software\Classes\AppID*APPID*.
Note: AppID is the ID that appears in your event viewer. In your case it's {316CDED5-E4AE-4B15-9113-7055D84DCC97}.
Right click on it then select permission.
Click Advance and change the owner to administrators.
Click the box that will appear below the owner line.
Click Apply and grant full control to Administrators.
Close all tabs and go to Administrative tool.
Open component services.
Click Computer, click my computer, then click DCOM.
Look for the corresponding service that appears on the error viewer.
Note: For this step, look for the one that appeared at the right panel of the RegEdit. For example, the AppID Registry (316CDED5-E4AE-4B15-9113-7055D84DCC97) contains the "Immersive Shell" Data with a (Default) as a name. Now look for "Immersive Shell".
Right click on it then click properties.
Click security tab then click Add User. Add SYSTEM then apply.
Tick the Activate local box.
Restart.
Hope that helps.
EDIT: I edited the step number 14 for it to be clearer. I am glad that I was able to help out.

ASP.Net Web Application Localhost Refused to Connect after Save

I am writing my first ASP.net Web Application using VS2015 and IIS 7.5. After I make changes in the code and save, I right click and hit View in Browser to see the page. A new tab opens in Chrome and the page comes up fine, but when I go back to the aspx page and make some changes and resave, when I try and refresh the browser tab that opened earlier I get 'This Site Can't be Reached Localhost refused to connect'. I then have to go back to VS and right click and View in Browser again which opens a new tab and the page works. Is there anyway to keep the original tab that opened persistent so I can just refresh it to show code changes? It's a bit tedious having to open a new tab for every change. Thanks.
Edit: seems to be a timeout issue as it doesn't matter if I make changes at all. Trying to refresh the browser after 20 or so seconds causing the connection refused error.
Turns out I have an asp:repeater that builds a table. The table had over 4000 rows in it. When I removed the table or when I reduced the rows to under 300 I was able to refresh the page as many time as I want. As soon as I bumped the rows back up to 4000 the issue came back. Not sure why the amount of data was an issue though.
Go to Tools-Options
Under Projects and solution -> Build
Run select "Always build" under "On Run, when projects are out of date"

How can we temporary off the running website & gives a message "This site is Temprorary unavailable"

How can we temporary off the running website & gives a message "This site is Temprorary unavailable", actully i want to gives a power to admin he can temporary on/Off the website... according to my need i dnt want to add web_offline.htm page. I simply do it by button control i.e. Active website & Deactive website(dynamic method)
I think the easiest way to do this per your requirements would be to create an app_offline.html, and connect a simple rename method to your admin on/off button. When the admin clicks On, rename the file to app_offline_.html, or whatever, and vice versa. That would be a simple implementation, and you could given the IIS worker process access to that one file for security reasons.

can not add an iframe tab

Ok, so I've done it a hundred time or more, but today - got a new problem.
created a simple html page with an image
uploaded to a server
opened the page in the browser - no problem, all works fine.
created a new app, selected "tab" and insert the tab name, the http and https url
Tried to view the app and got "The page you requested was not found"
I've checked with other iframe tabs that I've built, they all configured the same, yet the new one - fails to load.
I've seen that the interface has changed a bit, Its not unusual that Facebook breaks things from time to time but maybe I'm missing something?
Edit: also, from some reason I don't have the "View App Profile Page" on that app
They changed some things around, profile pages are no longer being made. Check this out http://developers.facebook.com/blog/post/611/
Although I'm still having problems with getting errors when I try to add the app

Background File Copy process in ASP

I have an application in classic ASP. On click of a button, it copies a file and its relative folder from one folder to another folder, and displays a link to user for the destination folder. User can click on link and get the file from destination folder. Now, I am facing problem with file and its relative folder size. I have some of them with size greater than 500MB. So, copy process takes so much time that my application gets Time Out error. **Is it possible to create some background process for copy? and when process completes it should fire some event. **
Cheers
This is a pretty lame solution, but a solution nevertheless: you could fire off an Ajax request to a separate ASP script to do the copying, and just put a really long timeout on that script. When this completes, it could, of course, update the calling page with an alert or notification to the user, but that very much depends on the user having enough patience to keep that browser window open.
The options I tried are,
Executing copy command from Shell, not effective because ASP page waits for shell command to finish.
Creating a trigger in SQL database which gets fired when a new row gets added into the table, and then copy the files and send an email to user using TSQL. This affects my overall database performance.
AJAX solution also waits for process to end.
Now the solution I have implemented is, ASP page just creates a request and displays a message to user that user will get an confirmation email, then I created a small windows application which keep on watching for any request generated by ASP page, and as soon as any request comes in, it starts copying the files and at end sends as email to user as confirmation.
This solution is working for my requirements, please do share if you have any better and robust solution for the scenario.
Cheers.
I thought of another idea. I'm not sure of the exact way to do this on an IIS server, but if I were running on a Linux server, I would set up a cron job to run a web script every 5 minutes or so. The script would check for new files and perform the copying. Since copying could take more than 5 minutes, you would probably need to keep track of files in an XML file or db or something.
This would free you from writing/maintaining a separate Windows desktop app.

Resources