Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Friends , i have published my website in iis(5.1) Local System and it is running success full. But the problem here is am using the Default URL to use the website, if i run another url of the same website i need to run my website with the default URL which is not happening. My website is running what ever the page url is given which should not happen.
What is the solution.


Any help will be appreciated.
Posted
Comments
Er. Tushar Srivastava 18-Sep-12 2:27am    
I am sorry, but I am not able to understand your problem. Please do clarify the question... It will be appreciated..... :-)

In the default page or the login page of your website create a session variable as Session["UserId"].

C#
Session["UserId"]=username;


Then on the Page_Load of every other page in the website or in the Page_Load of master page check if this variable has the value, else redirect the user to the Default page

C#
if(Session["UserId"]==null)
{
Response.Redirect("Default.aspx");
}
 
Share this answer
 
Comments
narlakanti 18-Sep-12 2:37am    
No, already published website how can i set the default url if i run any url in that website.
bbirajdar 18-Sep-12 2:55am    
NO..You cant change the internal functionality of a website without changing the code...
hi,

add the below code in session start event..
VB
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
      Response.Redirect("Default.aspx");
      'put here your default page
End Sub
 
Share this answer
 
and set forms authentication and provide login url, if u use master pages, better declare session variable in global.asax session start event and use something like above in the master page page load event. it works....
 
Share this answer
 

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