Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Ok, so I just had a problem that was solved where I couldnt use a custom HttpModule to do re-writing. Now, though, when I log in with the template created login screen, as soon as I get to the default page I get logged out for some reason. There is no code that should log me out! he code in the re-writer is the following:
var application = (HttpApplication)sender;
var context = application.Context;
var request = context.Request;
var response = context.Response;
var page = request.RawUrl.ToLower().Replace("/", string.Empty).Replace("?", string.Empty);
if (request.Url.ToString().ToLower().Contains("cms"))
return;
ACE.Dal.ACEEntities db = new ACE.Dal.ACEEntities();
ACE.Dal.Page cmsPage = db.Pages.FirstOrDefault(p => p.PageName.ToLower() == page) ?? new ACE.Dal.Page();
if (cmsPage.IsContentPage)
response.Redirect("ContentPage.aspx?pageID=" + cmsPage.PageID);


Thanks in advance.

Edit -- Info that may help:

From what I can see from my debugging, if I get the password wrong in shows the correct error and doesnt attempt to navigate away from the page. If I get the password correct, it navigates to the correct page, then once it gets there does a check to see if there is a user logged in. It see's that there isnt and redirects back to the login page.
Posted
Updated 19-Jul-11 6:10am
v2
Comments
Herman<T>.Instance 19-Jul-11 9:36am    
what is stored in your Session or ViewState when you debug this code line by line?
DominicZA 19-Jul-11 11:29am    
Nothing, but doesnt it usually create a cookie for the logged in person! From what I can see from my debugging, if I get the password wrong in shows the correct error and doesnt attempt to navigate away from the page. If I get the password correct, it navigates to the correct page, then once it gets there does a check to see if there is a user logged in. It see's that there isnt and redirects back to the login page.
#realJSOP 19-Jul-11 12:13pm    
Really? Using var types? How much harder is it to use the appropriate types?
DominicZA 19-Jul-11 12:23pm    
**Cough** I wont lie, I copied the code :P But does that have anything to do with helping me get the results I need?
[no name] 19-Jul-11 13:44pm    
Yes. Don't copy unless you understand what is doing and how to do it yourself.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900