Web Forms :: Streaming MP3s Based On Logged In User?
Apr 6, 2010
I have a requirement to be able to stream MP3s based on the user who is logged in. Eg, user 1 should only be able to listen to 1.mp3, user 2 should only be able to listen to 2.mp3 etc. All the mp3s would be stored in a particular directory on the server.
I am currently investigating the Silverlight audio player available at [URL]. However, I am unable to find a way to programmatically specify the file to stream once the user clicks the play button.
Are there any other media players/controls that allow streaming and also allow specifying the audio file to play programmatically?
I have a page that loads a two different files that the user uploaded during page_load. The code is an example I used from the aspsnippets site. The files are stored in a server folder while the location is saved in the database. The code below gets all files in the folder and binds them to a gridview.
Dim filePaths() As String = Directory.GetFiles(Server.MapPath("~/Uploads/2012/emp/")) Dim files As List(Of ListItem) = New List(Of ListItem) For Each filePath2 As String In filePaths files.Add(New ListItem(Path.GetFileName(filePath), filePath)) Next gvEmp.DataSource = files gvEmp.DataBind()
What I want to do is to get only one file per user as the fileID along with the location is saved in for every user. I ran a query to get the fileLocation and pass that location stored in the database instead of the current server path but I can't figure out how I would do it.
I have table called ROLE with fields (id,name,permission) example values (1001,madhu,hr)
I have another table called LOGIN with fields(id,DOB,password) example values(1001,24101989,madhukumar)
What i want is , if i login using the LOGIN table ,it check the id and permission in the ROLE table , if the permission is 'hr' it enable to access the menu , or if the permission is any other it just print the error message ("no permission")
Note: menu is placed in master page , but login is not in the master page ...
I want to know how can i redirect a user to a different page when he tries to access a page restricted to another role?
The scenario is as follows:
I have a folder "Gestao" that only allows users in role "Administrator"
[Code]....
If an anonymous user tries to access that folder he is redirected to the login page, but if a logged in user whose role is "friend" tries to access this folder he is also redirected to the login page. I want to redirect him to a page showing a message that he has no permission to access that page/area.
How can I do that? Should i have code on the Page_load event of the login page checking the user role and then redirect him to the correct page? Or is there some otherway to do this?
We have an application where the controls are dynamically added to the form based on the logged in user,
This user controls related data is stored in the database. There is lot of logic in the code behind in the asp.net webforms which is so messy to maintain it, we are planning to re-write it using the MVC framework.
I would say there would be rougly 50 different forms based on the user logged in, is it good idea to create so many views and redirect to the appropriate view based on the logged in user, in some of the forms there might be minor difference like the order of the Control might change.
I have the membership provider and the create user with tow steps, one of the steps contains a custom registration form, for each created user data will be in the database, and there is an account page shows the data that the new created user did insert during the registration process on the custom registration page,
the problem, when the user is created and logged into his account page, this account page shows only the information for the first created user, not the info on the logged in user , but the logged in user data still saved in database and not showing on his account page?
I would like users to upload a profile picture when they register, and to then show that picture in a picture box control when they are logged in based on that specific user.
I have an asp.net web app. I have secure parts to the website and currently I have it setup so that people can login with their domain accounts. The are three secure sections to the site, all of which require files of interest be displayed to the user so they can download them.
Okay so this is how I see it working, people come to the home page and select on one of the three options. At this point they are prompted for there domain password then they are navigated to the secure page and a bit of code populates the page with file downloads based on who they are logged in as.
The files themselves will be uploaded to the website and kept in folders named after the username. so for instance the user edwardh would be displayed the files in the folder /downloads/edwardh.
I deployed a website where a logged user or an anonymous user can select data and download a XML file. The website generate the XML file in the server and then deliver it.
It works fine in my development environment, but after deployment, the anonymous user can download the file, but the logged user receive this error:
System.UnauthorizedAccessException: Access to the path 'd:HostsLocalUserheringerwebsiteUpload20110107094051.xml' is denied.
It is weird that as anonymous i can do it.
The website server help states this:
"Grant write, modify, delete access rights on website's folder
Your website executes under unique user account that by default has full control over the website's folder. So your application can create, open, read, write and delete files and folders inside of your root folder.
There is no need and no way to change this permissions.
If, when running ASP.Net application, you still unable to create file or update it, you have to check your Web.Config file for "<Identity impersonate..." tag and remove it.
The only exception is when the application tries to modify a file or folder in "Application_Start" event of Global.asax file. This is by design that user authenticated only after the Application_Start even. Before the user is authenticated your website runs under an identity of Application Pool which is "Network services". That account doesn't have access to the folder of your website.
To make it work you eather have to move the code that tries to modify files or folders out of the "Application_Start" event of the Global.asax file or inside the event you'll need to impersonate your user by code."
But i am not using impersonate and the tag is not in my web.config.
In my web application.... I want chat with all the user are online. How to get the user and how to chat with each other .... I want to integrate chatting option in my website.
I want to implement user login function , that allow user to login after couple of weaks without asking username and password again. I have read many article and got that it is maintain by Cookie but don't know how to implement this one. A good example is seen in gmail, facebook [URL] .... that allow user logged in for couple of weaks. I also want to maintain a cookie table for just keepig the records of user logged in from different system.
I've made a membership by create user wizard. everything is good but after click on finish register button, when page redirect to index .aspx, this page thinks tht user logged in. whereas user didnt login just added to DB.here is the code:
How to retrieve the current authenticated logged in user's email address who is accessing the page.
I have managed to do it with users. How to get the current authenticated user's email address if that makes sense.
Here is my aspx code:
[Code]....
and my VB script:
[Code]....
Somebody suggested that I should run a query. If you know the user name accessing the page, surely you can take that information, insert it into a query to find out the email address of the user accessing the page. Sounds great but don't have a clue how to do it.
I have created a c# web project with Visual Studio 2010. I moved the default css file to the theme folder I had added to the project. I configured files this way: the Default.aspx is accessible by anonymous and loggedin users while all other pages are accessible by loggedin users only. I didn't use roles.
The issue is no theme is applied to the Login or Default.aspx pages if a user has not logged in.
i'm using forms based authentication within my aspnet (c#) website. At the log in page i'm capturing username, password and email. the email addressed is stored within the membership table. now on a new page, i'd just like to display the users' email address so they update it as well as another boolean field. i've tried using a gridview but i can't figure out how to modify the query so it only reveals the current logged in user.
in order to prepopulate some user information, i used query to search the sharepoint list. my question is how to search loggin user's info in the list. i used following testing query function. it works fine. however, it can only search specific text, cannot be changed according different user.
I want to check that the user trying to log-in is authenticated and it belongs to a certain role. For this I have wrote the following code
protected void btnLoginButton_Click(object sender, EventArgs e) { / if (this.User.Identity.IsAuthenticated && this.User.IsInRole("Admin")) { Response.Redirect("~/Admin/Default.aspx"); } if (this.User.Identity.IsAuthenticated && this.User.IsInRole("Editor")) { Response.Redirect("~/Editor/Default.aspx"); } if (this.User.Identity.IsAuthenticated && this.User.IsInRole("Moderator")) { Response.Redirect("~/Moderator/Default.aspx"); } }
But when I ran this code it gave me this error error CS1061: 'Page' does not contain a definition for 'User' and no extension method 'User' accepting a first argument of type 'Page' could be found (are you missing a using directive or an assembly reference?) I have already added following directives to cs page-
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
Can anybody tell what directie I should add for "this.User" <P.S> My application is web based and it is in ASP.Net 3.5(C#).
I would like to change the logged in user to another user temporarily to do some process.
For example, say I am logged in as "Joe". In my method, I want to make the logged in user from "Joe" to "SuperUser", do some process, then change the logged in user back to "Joe".
i want to generate the new sessionid in the same httpcontext once the user is successfully authenticated.so, how can i do that ? ( please dont ask why do you want it, i got such kind of requirement).
I have below code to display "list of all the online users" inside listBox using Membership function.
Code:
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MembershipUserCollection allUser = Membership.GetAllUsers(); // to get all the users List<MembershipUser> onlineUsers = new List<MembershipUser>(); //creating list of online users foreach (MembershipUser user in allUser)
[Code] ....
I want to remove that user from the list of online users, who himself has logged in. Example: if I had logged-in with UserName: Admin, then this Admin should not show to me in the list of "online users"
Tried below Code but not working:
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MembershipUserCollection allUser = Membership.GetAllUsers(); // to get all the users List<MembershipUser> onlineUsers = new List<MembershipUser>(); //creating list of online users MembershipUser m_user = Membership.GetUser(); //to get self logged-in user
we are migrating existing windows form application to asp.net(3.5) intranet portal, there is a requirement whereby database connection should be made by the logged in windows user. Is it possible to achieve this functionality?
I'm new with programming. I have a GridView that have the specific user data. When the user log in I retrieve the data for that specific user. All I need is; How do I make the gridview get the data of the logged user using a datatable that has a query. Just bind it with the datatable.This is some code that other programmer made, I continue his work.