.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

Weird behavior

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
 
I've made this "Minify" class that inherits from MemoryStream and I want to use it to minimise the amount of whitespace in for example css and javascript files. To begin with I'm not doing anything complex just a simple replace.using System;using System.Collections.Generic;using System.Linq;using System.IO;using System.Text;using System.Web;using System.Text.RegularExpressions;namespace Output{    public class Minify : MemoryStream    {        private Stream stream = null;        public Minify(Stream stream)        {            this.stream = stream;        }        public override void Write(byte[] buffer, int offset, int count)        {            string content = UTF8Encoding.UTF8.GetString(buffer);            content = LimitWhitespace(content);            stream.Write(UTF8Encoding.UTF8.GetBytes(content), offset, UTF8Encoding.UTF8.GetByteCount(content));        } &nbs


View Complete Post


More Related Resource Links

EXPERT: avoiding weird refresh behavior of Eval method in a tabpanel

  
I have this control in a detailsview:<asp:DropDownList ID="ddlEventStartDay" SelectedValue='<%#Cdate(Eval("startdate")).Day %>' CssClass="textbox" runat="server">    <asp:ListItem Value="1" Text="01" />    <asp:ListItem Value="2" Text="02" />    <asp:ListItem Value="3" Text="03" />    <asp:ListItem Value="4" Text="04" />    <asp:ListItem Value="5" Text="05" />    <asp:ListItem Value="6" Text="06" />    <asp:ListItem Value="7" Text="07" />    <asp:ListItem Value="8" Text="08" />    <asp:ListItem Value="9" Text="09" />    <asp:ListItem Value="10" Text="10" />    <asp:ListItem Value="11" Text="11" />    <asp:ListItem Value="12" Text="12" />    <asp:ListItem Value="13" Text="13" />    <asp:ListItem Value="14" Text="14" />    <asp:ListItem Val

weird Rating Control behavior

  
Hi folks! :)I have Rating control on my page. The page is a subpage of nested master page. On that page is updatepanel and wizard with TemplatedWizardStep inside it and inside TemplatedWizardStep is Rating Control.Master.Page -> NestedMaster.Page -> Content.PageI allso have googlemap inside that wizard(on different step) so i need to register google initialize() for it to work.So by registering googlemap like example below Rating Control freezes. Private Sub ScriptManager1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles ScriptManager1.Load ScriptManager.RegisterStartupScript(Page, Page.GetType(), "onload", "initialize()", True) End Sub But if i include script tags in string like example below, Rating Control does not freeze. Private Sub ScriptManager1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles ScriptManager1.Load ScriptManager.RegisterStartupScript(Page, Page.GetType(), "onload", "<script>initialize()</script>", False) End Sub Everythnig works, but i wonder, WHY :) Why is Rating Control freezing in sample1?

weird behavior in SSMS - backslash (\) is getting displayed as (#)

  

I'm experiencing some weird behavior in SSMS for SS2008.  When I create a new query and type the backslash (\) key a pound(#) symbol is displayed instead in the query window.  I've never experienced this behavior in SSMS 2005 before.  This is the first time I'm using SSMS 2008.  I work with a few developers who also use SSMS 2008 and they have no idea about this either.  Any idea whaat might be causing this behavior and any idea how I can fix this?  I'm using Windows 7 and the backslash (\) symbol displays as expected in other applications (Notepad, VS2010, etc). 

Please help!


Weird Thread.CurrentPrincipal behavior

  
msdn has a code sample illustrating the use of SetPrincipalPolicy. I copy the code and the output below:

using System;
using System.Security.Principal;
using System.Threading;

class ADPrincipal
{
    static void Main(string[] args)
    {
        // Create a new thread with a generic principal.
        Thread t = new Thread(new ThreadStart(PrintPrincipalInformation));
        t.Start();
        t.Join();

        // Set the principal policy to WindowsPrincipal.
        AppDomain currentDomain = AppDomain.CurrentDomain;
        currentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
           
        // The new thread will have a Windows principal representing the
        // current user.
        t = new Thread(new ThreadStart(PrintPrincipalInformation));
        t.Start();
        t.Join();

weird behavior in SSMS - backslash (\) displays as (#) in query editor

  

I'm experiencing some weird behavior in SSMS for SS2008.  When I create a new query and type the backslash (\) key a pound(#) symbol is displayed instead in the query window.  I've never experienced this behavior in SSMS 2005 before.  This is the first time I'm using SSMS 2008.  I work with a few developers who also use SSMS 2008 and they have no idea about this either.  Any idea whaat might be causing this behavior and any idea how I can fix this?  I'm using Windows 7 and the backslash (\) symbol displays as expected in other applications (Notepad, VS2010, etc). 

Please help!

 


Weird application behavior -- Action required to trigger service response otherwise the application

  

Hi,

I am a WCF beginner and is trying out with a basic host service with callbacks to the client.

My code works wonders if my client app is a console.exe but when I transferred the code to a Windows Form app, the application will freeze.  But if I right click on the form window task bar, the code suddenly goes through and it would work...

Is there anything wrong with this?

The service is hosted on IIS

Here is my Service code:

 

[ServiceContract(CallbackContract = typeof
(IChatCallBack))]
 public
 interface
 IChat
 {
  [OperationContract]
  void
 Talk(string
 msg);
  }

[ServiceContract]
 public
 interface
 IChatCallBack
 {
  [OperationContract]
  void
 OnCallBack(string
 msg);
  }

 

Implementation:

 

[ServiceBehavior(
  ConcurrencyMode = ConcurrencyMode.Reentrant)]
 public
 class
 Chat : IChat
 {

  

Package using Recordset variable showing weird behavior

  

Hi,

I am using a recordset variable in my package... say.. User::VarRecordset(Scope: Package)

I am first filling the User::VarRecordset using a Recordset Destination. Then, I am using this Variable in a For Each Loop..

The package works fine in BIDS. Even on Making a File system Deployment, It works on My machine, and some others too.

But on Some machines, the Execution Fails, showing an Error, Package Variable "User::VarRecordset" not Found in List of Variables..

The execution results do not show any error while putting data into "User::VarRecordset" . But FOR EACH Loop Fails with that Error..

 

Unable to find any reason, why it works well on some machines and Fails on Some.

My Machine is a 32 bit one...

 

Any clue or help to this requested...

 



Custom Editing Behavior for DataGridView TextBox Columns

  
For various reasons I'm using a DataGridView instead of a ListView, and while configuring the DataGridView to look like a ListView wasn't much of a problem, there's one thing that got on my nerves, which is the behavior of textbox cells in edit mode: It is much too easy to leave the edit mode accidentally, simply by pressing the cursor keys at the wrong time. For example when the text caret is positioned behind the last character of the textbox cell content, and you press the right arrow key

Run Button Behavior: Suggestion/Bug

  

Note: This could be a bug or considered as suggestion. I am not looking for solution.


1: I have ImageWatermark.cshtml open and currently in focus.

2: I have Photo1.jpg selected in left Files workspace.

3: Now if I Click "Run", instead of opening ImageWatermark.cshtml it trys to open Photo1.jpg and it fails.

So ideally I would expect the "open file (ImageWatermark.cshtml) to run rather than running the selection from Workspace.


Word Automation - Multiple DCOM Errors/Behavior

  
Before I get started, I already know that Microsoft does not support and highly discourages server-based MS Office automation.  I've read a multitude of posts and smarmy "*wink*, here's a link" replies, so I'm looking for actual help here, not condescending reprimands.

That notwithstanding, here is my problem.  I have developed a simple method that will open a local Word document, modify some header information, and then save the document as a new file.  As expected, it works great as a console/windows app, but as soon as I went to ASP.NET, DCOM jacked my world up when accessing the app remotely from a different domain account (that has access to the ASP.NET app.  For reference, my method is shown below:

  

1    public static string ModifyAndSaveBuildDocument(string localFilePath, BuildDocumentType docType, string buildNumber, DateTime buildDate, string projectName)
2            {
3                try
4                {
5                    ProjectConfiguration config = (ProjectConfiguration)ConfigurationManager.GetSection("ProjectConfiguration");
6    

Weird security configuration error message

  

Recently something has gone wrong with our website so that whenever you try to access an aspx file, it shows the following error:

 

Server Error in '/RALSWeb' Application.


Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Access is denied: 'RalsWeb'.

Source Error:

 
Line 256:                <add assembly="System.EnterpriseServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 257:                <add assembly="System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 258:                <add assembly="*"/>
Line 259:            </assemblies>

ModalPopup/UpdatePanel from codebehind, inconsistent behavior onClick

  

First post bear with me please:


I have a simple form with a list of linkbuttons, each fires the same onclick event which sets an indicator image.  I have a dummy button with style="display:none" which I have set as the TargetControlID of the modal.

onClick event from the imagebutton, the modal is shown via modal.Show().  The cancel button inside the modalpopup fires an event which turns off the indicator image and hides the modal via modal.Hide(). 

The events fire perfectly, it's very simple!  Although after doing some testing I noticed the modalpopup is not presented after the 6-10th cycle of clicking the open event, then clicking cancel.  The grey background appears but it is behind the main panel and the modal is either presented behind this or is just simply not displaying. 

I spent hours researching various methods, implemented the CancelControlID to see if it was somehow tied to my call of modal.Hide() that fails.

This occurs with an updatepanel only.  The behaviour is much cleaner this way, so I would hope to be able to implement this.  I have basically eliminated everything but these two events!  Please help


Weird "string;#" in combobox

  

Ok, while I am digging and digging myself into the world that's called Sharepoint I come to the next challenge.

 

I have two lists Projects List and Project Issues. They both have an id field (which is not the ID field of the record) and a title. I created two calculated fields for both of the tables which combines the title and the number for displaying in other pages.

 

example:

Projects List:

ProjectID: 2008-001

Project Name: First Project in 2008

Display Name (which is the calculated field): 2008-001 First Project in 2008

 

The calculated field formula is: =[ProjectID]&" "&[Project Name]

The field returns a string.

 

I also have a Worksheet list where my workers have to fill in their working hours. In this list I have two lookup fields. O

Weird problem in Detailsview - Dropdownlist in

  

Hi,

I'm new in this forum and I really hope you'll be able to help me.

I converted a field in the detailsview into a template field and put a dropdownlist in the <InsertItemTemplate> and it worked great. This is the code I put:

<InsertItemTemplate><asp:DropDownList runat="server" DataSourceID="sdsGenresPossible" DataTextField="Genre"  DataValueField="Index" SelectedValue='<%# Bind("Genre") %>' ></asp:DropDownList></InsertItemTemplate>


Now, I tried to do the same thing for the <EditItemTemplate> . This is the code I put there:

<EditItemTemplate><asp:DropDownList runat="server" DataSourceID="sdsGenresPossible" DataTextField="Genre" DataValueField="Index" SelectedValue='<%# Bind("Genre") %>' ></asp:DropDownList></EditItemTemplate>  

When I change the DV properties I do see that a dropdownlist was  added but when I run the program and click on "Edit" in the DV nothing happens (however when I click on "Insert" it works fine).

This is the Select command for the data source I used:

<asp:SqlDataSource runat="server"
          

IE 7 Weird error

  

NOTE: In firefox or Chrome not an issue, but in IE it just has become one.

CONTROL

<span  id="titleGannAngles" runat="server" >Title goes here</span>

Javascript global variable

var ogannangles = '<%= titleGannAngles.ClientID %>';


Js code in a function

document.getElementById(ogannangles).innerHTML="Object: Gann Angle,Grid,Arcs"+des;

It renders like this:      document.getElementById('ctl00_ContentPlaceHolder1_Chart_Volume1_Chart_Objects_Settings1_Chart_Objects_Edit1_titleGannAngles').innerHTML="Object: Gann Angle,Grid,Arcs"+des;

YET IE 7 gives me the error on this line:

document.getElementById(ogannangles).innerHTML="Object: Gann Angle,Grid,Arcs"+des;

That object is NULL or not an object ???

Why ???




Bizzare behavior of Digest authentication with HttpListener.

  

While trying to use Digest authentication with HttpListener, I expected it to act fairly close to how Basic does. Basic works fine with no surprises. With Digest, however: 

  1. HttpListener/http.sys driver takes on itself to authenticates user, without even passing request to my code (listener.GetContext() never gets unblocked) so ASP.NET application never has a chance to authenticate the user. I can see responses generated by "Microsoft-HTTPAPI/2.0" with WWW-Authenticate headers. I thought application should have a chance to authenticate the request with Digest user identity in the header. Is it possible to do?
  2. While insisting on Digest-authenticating users on its own, "Microsoft-HTTPAPI/2.0"/HttpListener/http.sys successfully authenticates domain users, but not computer users. I tried user name that includes computer name, realm name, computer name in the FQDN format - nothing works. Why such inconsistency?

Thank you,

Vlad.


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend