I have a web site coded with VB + MS Access database (VS2010). I'm using one MasterPage to manage both public and users area. I'm facing loss of session variables when a user is logged in. I can't figure out what is wrong and I need your help, tips and tricks.
When a user is authenticated (thru the Login.aspx), I create a SessionID, store his credential in session and load user's page by Response.Redirect(~/users.aspx). Here is what I did:Code:
Dim MyLink As String = Session.SessionID & "other variables"
Session("MyLink") = MyLink
FormsAuthentication.RedirectFromLoginPage(TextBoxEmail.Text, False)
Response.Redirect(~/users.aspx)
My logic is this: when the web site is launched, MasterPage + Default.aspx load. So Session("MyLink") is empty. If the user's credentials are correct, I create the session so that it can be available for MasterPage.
In the code behind of the MasterPage, I try to check (everytime a link is clicked/page requested) whether the user session (SessionID, credential in session) is available. If so, the user is still logged and get access to all the menu. If no session is available, it means the user is logged out or not logged in yet and few menu are shown. Here is the code
Dim MyLink As String = Session("MyLink")
If MyLink Is Nothing Then
'Only show MenuPublic
[code]....
My default menu is:MenuPublic1, MenuPublic2, MenuPublic3
When a user is logged in, I add to the MenuPublic some reserved Users' menu like below.
MenuPublic1, MenuPublic2, MenuPublic3, Menu_Users1, Menu_Users2, Menu_Users3
In local, everything works perfectly fine. Now after hosting my website, from time to time the MasterPage loss the Session variables. When it happens, the page still shows that the user is logged in by displaying Logout and Welcome Username beside it.
Recently I got a strange behavior, the website hangs and just doesn't reply unless I go to iis and restart either app pool or whole IIS - BUT what is the most strange thing is that in case I go to remote desktop of the server and try to access it locally it DOES work just fine. I read couple threads about deadlocking and hanging because of memory leaks and non closed sql connections BUT why it still does work from the local?In case there is something wrong with the code - why does it still work from locally?
I'm using Session variables inside a web service to maintain state between successive method calls by an external application called QBWC. I set this up by decorating my web service methods with this attribute:
[WebMethod(EnableSession = true)]
I'm using the Session variable to store an instance of a custom object called QueueManager. The QueueManager has a property called ChangeQueue which looks like this:
When I began my first ASP.NET project, I didn't know about Masterpages, which was a pain. Because I had to manually change each and every link on all of my web pages. This was all mainly for the top menu and side menus.
But now that I'm using a master page, I think it's going to be much easier. But, I'm running into an issue.
When the user loads default.aspx, they see the following on the top menu.
Which is how I want it. But, what if they click one of the links? Before, I just updated that code to make the button of that page the active one. But, if they're all inheriting the same page, how do I commit this changes? I don't want to omit that part and manually change it on each page, because that would beat the entire purpose of doing this.
I also don't want to create another master page for each link. That would also beat the purpose.
I'm changing the CSS of my menu items during runtime to reflect which page is currently being viewed. It works fine. But, I have a nested master page that needs to change the CSS of the master page's items. How I can access the master page's menu items?
In my masterpage, I have a menu that hosts an anchor. That anchor points to a another page and looks like this:
ASP.NET Code: <a href="../resources/techs/masterlist.aspx">BOMs & Service Manuals</a>
I used the designer to input the href location. This page and the "masterlist" page are using the same masterpage.
When I run default.aspx and click that link, it works no problem. But when I click that link from the masterlist page, it throws an exception because it can't find the file. Which makes sense, it's looking for "/resources/resources/techs/masterlist.aspx" because that page is already within that directory. I know how to format that link you point to itself no problem, but I can't figure out how to do it so that I don't have to manually change each page, nulling the purpose of the masterpage.
I'm having a hard time with the page cycles when using masterpages and contentpages. My masterpage has two linkbuttons that are used to select a language (using resources). When these buttons are clicked I create Session["language"]. The goal I have is to 'translate' my masterpage after the buttons are clicked AND to translate the content page.I've been trying all kinds of different methods (Page_Load etc) based on this url: http://msdn.microsoft.com/en-us/library/dct97kc3.aspx but it never works like it should. Usually the content page only gets translated after two clicks. I can't figure out the cycle problem between the masterpage and the content page combined with the click-events.
I'm new to asp world, and I have to keep my new job :)Switching form php to asp.net 3.5 (never used before). What would be the best practice for storing a SESSION variable in my project ?How can I prevent my SESSION to be overwritten if my initialisation code is in the onPageLoad method of my MasterPage ?My variables keeps beeing overwritten, please someone help me and tell me if there is any other solution than dealing with this pageLoad problem.
I am working on some refactoring work from cold fusion to .Net and I have a login page which redirects to a mainpage --> aaa.aspx. It displays the current news from the database and then I have some links coming from the masterpage which are embedded inthe same page as well. This masterpage has links to pages which are in both .Net and CF.When the aaa.aspx was initially in Coldfusion, it would redirect to all these links in the masterpage without any issues, but from the time I re-wrote the aaa.cfm to aaa.aspx, the links in the master page that are embedded in the aaa.aspx would not work,i.e they would redirect back to the Login page. My session looks like it is persisting to the aaa.aspx page, but not to the master page elements.At this point, I am not sure as to what is causing this issue.
I have a web site using master page and login page. I use the MasterPage to check the availability of a session. I'm coding with VB + MS Access database.I believe something is wrong with my master page and I can't figure it out. In the code behind of the MasterPage, I try to check the user session is available. If so, the user is still logged and get access to all the menu. If no session is available, it means the user is logged out and few menu as shown. Here is the code
[Code]....
Please note that my Login.aspx page is also base on the same MasterPage. On the Login.aspx.vb, if the user credential are correct, I did this:
[Code]....
So my logic is this: when the web site is launched MasterPage + Default.aspx load. So Sesson("MyLink") is empty. If the user's credential are correct, I create the session so the it can be available for MasterPage.My default menu isMenuPublic1, MenuPublic2, MenuPublic3When a user logged in, I add to the MenuPublic some reserved menu like below.MenuPublic1, MenuPublic2, MenuPublic3, Menu_Users1, Menu_Users2, Menu_Users3I'm testing my application on two different web hosting server: aspspider.com and somee.com. In the local, everything works perfectly fine.My problem is that on aspspider.com if a user logged in and then click on any MenuPublic, the application does not let him show information from Menu_Users. It's wrongly sending him to the login.aspx but still show his profil on the masterpage and the "welcome username" with beside the Logout link. It seems like the user is still connected but cannot have access to users pages.On the other server (somee.com), even if the user logged in successfully, I still have "welcome guess" with beside the Login link. I also have the user's profil information with all the links. If a user click on any MenuPublic, he can still see all the Menu_Users. But if he clicks on any Menu_Users, the application redirect him to the login.aspx; but still displaying all the information as if he is logged.The package deployed on both server is the same; except the connection string.FYI, I have Global.asa in the package but I don't use it. The web.config has plenty of stuff that came when I first start the project. The only thing I added is the connection string.
Situation:In Web.Config we have CustomErrors turned on with redirectMode="ResponseRewrite".In Page_Load of our MasterPage we access the Session property of the Page.
Problem:When an Error occurs on any page the user gets redirected (via Rewrite) to our Error.aspx Page. There in the Page_Load of the MasterPage we access the Session and get an HttpException telling us to enable SessionState. But we have the SessionState enabled, definitly.
Question:How can we access the session after a UrlRewrite in the Page_Load Event of our MasterPage?
In my application, session value automatically set into null.In certain workflow only it will set as null (Normally It's able to access value). Example, at the time of login, I will set session values. While, user deleting some entries from drop down list of specifc page,client script will show message like selected entry deleted. After that, flow point will move to master page. There I have to access session variables. It's getting null value. I tried to debug with Quick watch, at the pageload of master page only value set into null (automatically).
Google's webmaster tools has started showing some very strange internal links for my site. It appears "normal", but I'm not sure what to make of it. If you use parentheses and put in a single letter, then put literally anything in parentheses after that, the link works. I did a search for any other MVC sites so I could see if they had the same behavior. Microsoft's site came up at the top of the list with an odd link as well. The search terms were "asp.net mvc site" and the first link I got was for: [URL]
I don't like this at all. You can change the S to an A or any other letter, and then put any text you want in the next section. Anyone know how to stop it? For the life of me I can't see anything wrong with my routes. I used MVC so I wouldn't have strange url's floating around in search engines so this is pretty disappointing. Nearest I can guess from the Google "internal links" list is that it may be a cookie. But I can't find any circumstance when I view the source on my site where I see anything but the proper relative links.
Every few days when my webpage is accessed strange characters are embedded in the URL like this:[URL] I did some searches on the internet and found that if the characters begin with the letter 'S', it is the session id used when cookieless is set to true. In my case the beginning letter is 'A', and i couldn't find anything about that. This is bad because once these strange characters appear, all the submenus in my page will disappear (I had another post about his menu problem in here:[URL]
Once I restart the webpage in IIS the URL will become normal again, but it will appear again in a few days. Does anyone know what these strange characters (that begin with 'A') are? How to avoid them?
try to figure out what is wrong with my code but I'm lost. I've a ModalPopupExtender, triggered in code behind by the onClick event link button. The FIRST time I display my popup, it works well and if I close my popup using javascript, it works and I can get my popup back by clicking on my linkbutton again. But, if I click the "Save" button of my popup (which save data and close the popup), I can't get my popup to display again. Even if I close my popup first using javascript and then calling my server side code to save my data, the result is the same, I can't display my popup again. Seems like the postback "break" it.This popup is in an conditinal UpdatePanel and event trying to manually update the panel after the popup.show() method change nothing.Finally, I checked what server sent back to the browser using firebug and I can confirm that I received only view state information (no UpdatePanel to update), even after calling panel.Update().
I have a crazy issue when tabbing from one textbox to another.
This happens on a webpage which contains about 20+ textboxes, and this happens on the same textboxes, and I have no idea what is the cause.
When the cursor is in a textfield, I type in a value, hit tab, the focus goes to the next textbox, I hit tab, the focus stays in the same textbox, I have to hit tab again to go to the 3rd textbox.
This is annoying because the user is types their values, hits tab, starts typing values for the next txtbox, only for the cursor to stay in the pervious txtbox.
I have one web page that has some spanish contents , in design view it shows fine , but when I view it in browser, it shows gibberish character, for instance: i have following character in desing view Unión and it gets dispalyed Unión in browser what am I doing wrong, or is there any reference I am missing.
Have an application which publishes XML data across webservice using SOAP.
The data is pulled directly from an Oracle database and parsed into XML but for some reason the data being pulled out of the DB is throwing the following invalid XML exception.
Have done a bit of research and it looks like it may be a NULL character somewhere in the data which XML parser doesn't like.
Just wondering if anyone had seen this before and if so were they able to fix it at application or database layer?
Here's stack trace...
[code]....
UPDATE: Here is a selection of data being published.Just plain text basically, this is how it exists in database columns, have included as comma separated.
I have a project spec to build an online card game, and on a point it mentions:
"...the page should not post back to the server at any point; neither should the ASP.NET UpdatePanel control be used. Server communication should occur through webservice calls or similar."
I just asked a developer if it's possible to use AJAX without UpdatePanel, or/and use just a web service to prevent a page postback, and he said "the spec sounds a bit out of context".
Basically the application should provide a user interface and use Async postbacks (i.e. AJAX)...
In my website I use a <asp:menu> control in the master page. And I use Web.sitemap file to define the menu items. And everything works fine.But every few days when I click on the menu item tabs to change to another page, strange characters are embedded in the URL like this:
(supposed to be just http://www.mydomain.com/nextPage.aspx)
By checking the following MSDN link I realize that these strange characters stands for anonymous user: http://msdn.microsoft.com/en-us/library/aa479315.aspx
However, I already set the following in web.config:
but these strange characters are still inserted into the URL every few days.Once it happens, I need to restart the website, or restart or recycle the Application Pools in IIS, then it will become normal again.
I am trying to do a login page which checks username and password from access database. I think my code is almost done but i am getting some weird error which i just can't decipher where it exactly comes from, as i think i already have every return value it needs. Can anyone check this function and tell me if there is something i am missing or doing wrong? And the error i get isDBConnection(string, string)': not all code paths return a value