Click here to Skip to main content
16,019,184 members
Please Sign up or sign in to vote.
1.33/5 (2 votes)
See more:
Hello friends,


we are using web application . for that for authentication and capturing IP address we have a windows form. based on success authentication check am redirecting to IE with query string.
but i have a problem. the Home page after login if i copy the URL . and when i paste the URL on new browser it opening with out authentication.

any suggestions to resolve the issue.


thanks
karthik
Posted
Comments
karthikkushala 10-Jul-12 4:54am    
Hey sorry . windos form Mean i created an desktop application which is used to login the user and after checking of my coditions. am redircting to IE
InternetExplorer IE = new InternetExplorer();
IWebBrowserApp wb = (IWebBrowserApp)IE;
wb.MenuBar = false;
wb.ToolBar = 0;
wb.StatusBar = false;

if (IE != null)
{
object Empty = String.Empty;
object URL = "http://URL.aspx?Id=" + Id + "&Pw=" + PW + "";

IE.Visible = true;
IE.StatusBar = true;
IE.StatusText = "Loading....";
IE.FullScreen = true;
IE.Navigate2(ref URL, ref Empty, ref Empty, ref Empty, ref Empty);

}
Vani Kulkarni 10-Jul-12 6:01am    
http://URL.aspx?Id=" + Id + "&Pw=" + PW + ""; ---> Are you displaying UserID and Password in the query strings? Don't you think it is a bad practise? As UserID and Password are easily readable anyone can access your application.

Have you set up allow and deny rules?

You need to inform the system that you require users to be logged in, before they can look at certain pages.
And you can also say that some pages, or all the pages in certain folders, require users to be in certain roles.
You do this with allow and deny in web.config
If you have pages in different folders, you can have a little web.config in each folder that gives the rules for the pages in that folder.

For example, here is a web.config file where:
Users with adminstrator role are allowed. allow roles="administrator"
All other users are banned - deny users="*"
This applies to all pages in that folder.
XML
<configuration>
  <system.web> 
    <authorization>
      <allow roles="administrator, developer" /> 
      <deny users="*" />
    </authorization> 
  </system.web>
</configuration>

For more information look at: Copy paste of url in new browser window should take me to Login Page
[^]
 
Share this answer
 
v2
Refer:
Introduction to Membership[^]
and set appropriate access to users in your web.config.
XML
<configuration>
    <system.web>
        <authorization>
            <allow roles="Admin" />
            <allow roles="User" />
            <deny users="*" />
        </authorization>
    </system.web>
</configuration>


Also have look on similar discussion:
How do I prevent URL entry and redirect the user to login page[^]
How to Redirect Users to an ASP.NET page when not Authorized[^]
 
Share this answer
 
v2
If you are using the ASP.NET application then use web.config, roles and membership APIs to achieve this. you might find these links helpful.

Understanding ASP.NET Roles and Membership - A Beginner's Tutorial[^]
Understanding and Implementing ASP.NET Custom Forms Authentication[^]

Let me know if my understanding is not correct and I will try to refine my answer.
 
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