conversion from asp.net web site(.aspx pages) to WCF service - asp.net

i have developed a web site using asp.net. In the web site if user enters username and password he will proceed to the next pages say home.aspx, dailyreport.aspx which is correct.
But the problem i'm facing is if the user enters url of the any page say domainname/projectname/dailyreport, then he will be in the desired page. then what is the use of having login page... how to deal with this issue....can anybody please help me. please as soosn as possible....

At a minimum, you need to enable Forms Authentication. This will ensure that any unauthorised users are redirected to a login page, from where they can access the site.
For more information about Forms Authentication, try this;
Explained: Forms Authentication in ASP.NET 2.0

Related

How can I check if a URL is inside my ASP.NET App?

I am planning on creating a login form via ASP.NET MVC with which the user should gets redirected to a new site.
The site to which the user should get redirected to is defined by a script based on the current referrer.
But I want to validate this URL before a user logs in and get redirected to a unknown site outside my server.
How can I check if a URL is from my Application?
I think it is. Enjoy.
Url.IsLocalUrl(yourReturnUrl)

Automatically Sign In Sharepoint 2013

I want to sign in to a SharePoint portal through calling a web page. Forms based authentication is enabled on SharePoint.
The scenario is as follows:
Calling /_forms/default.aspx?username=userX. which is the default page for forms authentication in sharepoint.
The page create and set authentication ticket for userX without asking his password.
The page redirected to some default page.
I have tried to manipulated /_forms/default.aspx to create ticket using FederatedAuthentication.SessionAuthenticationModule.AuthenticateSessionSecurityToken,
but no result.
I'd greatly appreciated if some one helps me.

How to validate if a user has logged in website in ASP.NET MVC2?

I have a table in database called Customer, I want to enable them to log in website? Is there any good practice to suggest? Thanks!
Enable forms authentication in web.config.
Create a login page, and in login method, validate the user. Use FormsAuthentication class to set the authentication cookie.
Here is a write up for the forms authentication
If you create an asp.net mvc site project in visual studio, you will see an implementation of authentication.

Pass user credentials between SharePoint web application and ASP.NET web application

I need to integrate my sharepoint site and ASP.net site. So, First login will occur in the SharePoint site with Active Directory authentication and from there i need to traverse to ASP.Net site through a link. Now my question is whether its possible to pass my SharePoint Active Directory credentials to ASP.Net site? Will i be able to do this through a query string? Will i be able to navigate to and fro between SharePoint and ASP.Net sites.
The main point here is the user should not enter his credentials twice ( ie.. He should be authenticated automatically while navigating between two sites.)
What are the options available for me?
Do these things possible to achieve? SharePoint will be hosted using Windows SharePoint Services 3.0.
Thanks in advance,
ReplyQuote
Is the ASP.NET site on the same network? If so, then you can use AD (Windows Auth) for authentication on the ASP.NET site just like you're using it on the SharePoint site. You don't need to pass the credentials, and you can't anyway since all you have is an authenticated identity. If you configure the ASP.NET site to require Windows Authentication, you'll be able to get the user's identity from the server variables (AUTH_USER).
See How to: Use Windows Authentication in ASP.NET 2.0

Run custom code on login

I’ve used the asp.net login control on my sharepoint custom master page. All works well and I can login to my site without problems.
However I’d like to run some code once the user has logged, or alternatively perform a redirect based on the user’s role.
Has anyone does this type of thing before?
The Login control (System.Web.UI.WebControls.Login) has an event LoggedIn (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.login.loggedin.aspx). Just subscribe to it and place your code in the handler. I haven't worked with sharepoint, I'm talking from an ASP.NET viewpoint here.
You can test roles programmatically through User.IsInRole
EDIT: on redirect from the ASP.NET login control, check for the forms authenication token and run your custom code if the token is present.

Resources