I made a small web application (ASP.NET) that use the DocumentPrint.Print() to use a printer that connected on the server and when run it from the visual studio its work well and print the document correctly,
Hint : the address will be : http://localhost:8080/
but when use the iis server (http://localhost/TestPrintingWebSite) the printer never work and then the website didnt effect to the server printer.
is there any setting must be on the iis to let me able to use the server printer ???
please your help guys ;)
thanks alot
By default in IIS, the account used to run ASP.NET applications will lack sufficient privelages to access the network printer.
In order to access the printer you will need to either use impersonation in your code:
WindowsIdentity.Impersonate Method
Or configure IIS to run the application under a user account with the required privileges.
Here is another article which explains different methods of impersonation security:
Understanding ASP.NET Impersonation Security
Edit
If you do not feel confident implementing the user impersonation code yourself, here is a link to a codeproject article: (the code is in c# but could be easily converted to VB.NET or compiled into a separate class library and used in your application)
A small C# Class for impersonating a User
Related
We are developing asp.net website, API and MVC project using Visual Studio. Currently the system we're using are using local administrator account. We are now mapping it to the domain user (normal user). However, certain features are not supported by Visual Studio when we do things like this... importantly..
Debugging applications that a run under a different user account,
such as ASP.NET websites.
Deploying a web application to Internet Information Services (IIS) on a local computer.
Check MSDN Doc here
Note that deploying to IIS is not an issue for us, however the we're unable to debug the application and that is real deal breaker here!
I would like to know how to do debugging for asp.net websites when using domain mapped normal user.
I know this is not a programming related question. However, seems like most of dot net programmers are affected with this and I don't know where to ask for help, so posting it here. (Suggest if any other site is suitable for this!)
Thank you for your help in advance.
The simple answer, as mentioned in that MSDN document and this SO question, is that you can't.
It might be possible to do it through roundabout ways, such as changing the credentials that the IIS worker, application pool, and related processes run as, but even if it were possible, it wouldn't be supported, and most likely wouldn't be worth the effort. Here are two very old articles that deal with the topic:
https://msdn.microsoft.com/en-us/library/aa289173(VS.71).aspx
http://jameskovacs.com/2006/03/16/debugging-as-a-nonadmin/
It may be more feasible if you're able to run your application in an OWIN (Wikipedia) container running in an alternate (to IIS) host.
I have a strange problem for which I can't find a solution.
Currently we have a development Server (running a normal Azure Virtual Machine) and a production Server running a Web Role in Azure Cloud Services.
For the Web Role we need to add the "RoleEntrPoint" class.
But as soon this class is present, the Web Api on a normal VM on development server with IIS 8 returns a "404" for all routes.
This problem is similar to: http://jake.ginnivan.net/web-api-problem-404s-for-everything/
(As a side note, opposed to the blog post I'm not using EntityFramework. We just added the RoleEntryPoint class and copy local for Microsoft.WindowsAzure.ServiceRuntime is true)
But I can't find a solution or catch any errors thrown.
Do you have any ideas on this?
It makes sense that if you're not running as an Azure role, then RoleEntryPoint would break things. Can you make your development VM also a Web Role? If not, then don't use RoleEntryPoint and use ASP.NET lifecycle management methods instead.
From the documentation:
Web roles can optionally extend the RoleEntryPoint class, or can use the ASP.NET lifecycle management methods to handle the start and stop sequences.
So, the ASP.NET methods will work for both VM and Web Role. You didn't say what you're trying to do with the RoleEntryPoint, so I'm not sure what further guidance to give.
I've got a .Net application running inside a Citrix environment and I need a way to identify the user logged on to the citrix client using forms authentication. Is this possible? I've seen some post regarding a Citrix SDK but not sure if solves my issue...
I'll preface my statements by saying I know next to nothing about ASP.NET and Forms Authentication (which from brief Googling appears to be a way to implement custom auth in ASP.NET).
Any app running a Citrix session will have access to the identity of the user. It will be running as the users' identity already and so you can query the current security principal to see who the current user is. You don't need to use any special Citrix SDKs. It's a common assumption by devs that they need to do special stuff as soon as their app is running under Citrix. However in most cases you can develop your app as-if it were running on the users' local desktop, and just deploy it on a Citrix server instead.
So for a regular .NET desktop app you can use properties like: Environment.UserDomainName and Environment.UserName to get details about the current user. Other stuff of interest is System.Security.Principal.WindowsIdentity, you can use the GetCurrent() static method to get the current users' identity.
Now as I said initially this maybe different for your case as it sounds like forms authentication is some kind of custom auth mechanism, so what I've said may not apply. But hopefully I've given you some useful pointers.
Help!
I am absolutely clueless on this. I've been told that the web application I'm building (.net 4 / mvc3 / c# / sql server) will be "sitting behind UAG so we can silently authenticate". I've no idea now how to approach the authentication part of the build in my dev environment.
Should I just use "windows authentication"? Will that be the required setting when the application goes live? How do I test the authentication?
The people asking me to do this are currently just getting started with UAG too do so any help, pointers, explanations or suggestions will be very much appreciated.
To put the situation in context, this application will be accessible via the company network internally, and also via the web externally (via UAG portal, of course). The company is on Active Directory, and all I actually need to "pull through" to the application to get further people entity data is the AD username.
Thanks in advance..
:)
Which authentication method you use depends completely on your application. I wouldn't worry too much about the UAG, as the idea should be that an existing web application can sit behind this product, rather than we have to customise our web application to sit behind this product. UAG should do the authentication/credential creation heavy lifting.
So in that regard, what is your user model? Do you want people to have to log on, or should their Windows credential be sufficient? Do we want Forms Authentication or Windows?
As an aside, we used the product when it was IAG, and it wasn't the greatest. If there was one thing it definitely did NOT enable was silent authentication. We had more problems with it than the problems it was trying to solve!
I have followed numerous tutorials and walkthroughs/blogs about the capabilities that Ria Services brings to the table when using Silverlight with ASP.Net. Essentially I am looking for a live working example of the authorization functionality that Ria Services can apparently take hold of from ASP.Net. (Even better if it works with ASP.NET MVC too)
Example of failed to work Ria Services authorization implementation
Navigate to the live demo link on this page....fails
This one may work however I couldn't get it to work on my office computer(strange setup that seems to break code for no reason)
Check here: enter link description here. There is a bunch of posts giving samples. It not exactly what you want but has a walk-through for setting up full authorization.
Brad Abrams has some good information. Also note that the new "Silverlight Business Application" template in the Visual Studio -> New Project dialog has authentication set up already where you can mess around with it without having to figure out how to set it up first.
http://blogs.msdn.com/brada/archive/2009/10/05/business-apps-example-for-silverlight-3-rtm-and-net-ria-services-july-update-part-26-authentication-and-personalization.aspx
C# Silverlight with RIA Services Authentication
Most likely you haven't configured your environment yet. In the machine.config file for the framework version in use, you will find LocalSqlServer defined. You should edit this definition to point at the SQL Server serving up the aspnetdb database that you want to use (and if you don't have one then start by setting up that).
Machine.config is generally in c:\windows\microsoft.net\framework\v2.something\config
For development you have to configure this in the workstation machine.config to make the debugger's webserver use your production authentication database. For production you have to do the same configuration on the production webserver.
There are different paths for 64 and 32 bit framework instances, and if like me you have 32 and 64 bit editions of version 2, 3, 3.5 and 4 then you have eight "root" configuration files. If you hunt them all down and set all of them it will save untold confusion later.
This is from my blog last october:
The Business Application Template for Silverlight comes with a login and register pages. It is very easy to connect these to a ASPNETDB.mdf.
Just add a LocalSqlServer connection string to your web.config file. For example, here is what I use to connect to Sql Server.
It’s almost too easy!
If you are using SqlExpress on your dev machine, it gets even easier. You don’t have to do anything. Just create a new Silverlight Business App and fire it up. Go to the log-on page and register. It will be slow, but in the background, your ASPNETDB was just created and attached, and you will be logged in. If you then look in the Web.config file, you won’t see a connection string anywhere, as the defaults are used for this piece of magic. Of course, a real world connection is going to need it’s own connection string like the above.
Greg