Posts Tagged ‘ASP.Net’

Convert file extension to MIME type - extended

In my last post I wrote a sample class that converts file extension to MIME type. Is it obvious that in many cases it is much better to have configurable list of mappings. For instance, you may have a configurable “white list” of file extensions that your web application allow to be uploaded and then [...]

Convert file extension to MIME type

Sometimes in a web application you need to upload files to the server and then download them to the client. To send a file to the client for downloading we need to specify a MIME type into the response content type parameter. This way we provide an information to the client browser what is the [...]

FormsAuthentication.Encrypt(ticket) returns null

I’ve done a sample today and I need to create FormsAuthenticationTicket manually in order to make it inexpiable. I create specifying null for user data in the constructor.

1: FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, FormsAuthentication.FormsCookieName,
2: DateTime.Now, expiredTime, persist, null, FormsAuthentication.FormsCookiePath);
3: 
[...]

Access an web service from web application with different default credentials

Today, a developer from the team asked me how to access a web service in our domain with user default credentials but for different user that those in WindowsIdentity.GetCurrent().
Let’s say that there is a web site that is configured to use Windows authentication in ISS and in the web configuration file we have Windows authentication [...]