|
Hi,
I hav a login page in my solution VS2005. If the user exist then it redirects it to my default.aspx page, if the userid or password is incorrect it display the error message, but after typing the correct info. of the user it does authenticate and authorized the user but it doesnt redirect you to the default.aspx page it will will just redirect you to the login.aspx displaying the userid that it is already authorized. Can somebody help me?
My solution: Login1.FailureAction = "Refresh" when I tried to swith it to Login1.FailuerAction = "RedirectToLoginPage" still the same problem. Could it be that I missed some codes coz everything in login page is working fine.
<br />
if (bUserExists)<br />
{<br />
string sroles = GetUserRole(Login1.UserName);<br />
FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(1, Login1.UserName, DateTime.Now, DateTime.Now.AddMinutes(30), false, "Director", FormsAuthentication.FormsCookiePath);<br />
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(Ticket)));<br />
Response.Redirect(FormsAuthentication.GetRedirectUrl(Login1.UserName, bIsPersistentChecked));<br />
}<br />
else<br />
{<br />
Login1.FailureText = "User Name / Password is not correct. please try again.";<br />
}
Dabsukol
|
|
|
|
|
Please help.
I got big problem.
I am working on plugins for my program. Load a list of plugins, double click on certain dll and it shows plugin window.
I have created a plugin and tried to test it, and I get this error: "Exception has been thrown by the target of an invocation"
This is the code that manipulates (calls them) with plugins:
Assembly ass = Assembly.LoadFile(Application.StartupPath + "\\Modules" + lwAddin.SelectedItems[0].SubItems[1].Text + "\\" + lwAddin.SelectedItems[0].Text);
Object o; Type t;
string str = lwAddin.SelectedItems[0].Text;
str = str.Substring(0, str.LastIndexOf("."));
t = ass.GetType(str);
o = Activator.CreateInstance(t);
Form frm = ((Form)(o));
frm.Show();
Variable str is in Namespace.ClassName format and I have test this code above with some sample module (just displays the window) and worked fine, so, I've created this new module, tried and get above error.
That plugin is added to my projects solution as class library project.
What should I do to avoid this?
Thanks in advanced.
|
|
|
|
|
Just a guess, but maybe the type you're trying to create has no default constructor.?
If that does not solve the problem, does the exception you get provide any inner exception and what does the stack trace look like?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks for your reply.
I've added an entry point and then tried, but same error appears.
Ironically, WindowsApplication project (made in VS2003), later converted to ClassLibrary, works great with my module code posted above, so I stopped trying to get it to work and create it as a standalone program rather then module .
Maybe it is some simple mistake I made occasionally and didn't realized it until I start testing .
Anyway, here's the stack trace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at ProjectCube.frmModules.lwAddin_DoubleClick(Object sender, EventArgs e) in E:\Development\Current Projects\Modules\Forms\Modules.cs:line 86
at System.Windows.Forms.Control.OnDoubleClick(EventArgs e)
at System.Windows.Forms.ListView.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at ProjectCube.frmMain.tbAddIn_Click(Object sender, EventArgs e) in E:\Development\Current Projects\Modules\Forms\MainForm.cs:line 435
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ProjectCube.Program.Main(String[] args) in E:\Development\Current Projects\Modules\Program.cs:line 37
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
|
|
|
|
|
Hi:
This is my first time posting to this board and I'm relatively new to programming with Visual Studio 2005 but I'm not new to programming in general.
I have a database app which uses a DataGridView control with 4 columns displayed. This is constructed with drag and drop from Data Sources and works well.
I would like to provide a textBox control that indexes into the "Name" column of the Grid View as a string is typed in the box. I.E. if I type a "V" the grid goes to the first name which starts with V then as I type the rest of the name it goes to the first name that starts with the letters in the textbox. The user can continue typing until he types the entire name or sees the name he wants and selects it with the mouse.
Is there a control to do this?
Thanks
Edwin
|
|
|
|
|
I am making a window for editing text in a textbox control, but I am having a problem... Here are pictures of my window before and after resizing: Image[^] As you can see, the SizeGripStyle object goes underneath the text box. This is how I am coding my window:
<br />
class FileWindow : Form {<br />
TextBox test;<br />
<br />
public FileWindow() {<br />
test = new TextBox();<br />
test.Multiline = true;<br />
test.WordWrap = false;<br />
test.ScrollBars = ScrollBars.Both;<br />
test.Location = new Point(0, 0);<br />
test.Size = new Size(this.Width-8, this.Height-33);<br />
test.Font = new Font("Courier New", 10);<br />
<br />
this.Controls.Add(test);<br />
this.Resize += new EventHandler(ResizeTextBox);<br />
this.SizeGripStyle = SizeGripStyle.Show;<br />
}<br />
<br />
public void ResizeTextBox(object sender, EventArgs e) {<br />
test.Size = new Size(this.Width-10, this.Height-35);<br />
}<br />
}<br />
(Sorry for having a whole bunch of code; I figured any of it might have been the problem)
Any ideas on why my window is doing this?
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
Maybe because the TextBox isn't anchored to all four sides of the Form?
P.S. I always hide the size grip; it's ugly and unnecessary.
|
|
|
|
|
How can I get this: Image[^] (The dark blue arrow on the side of the ToolStrip that expands to show more options) to show up on my ToolStrip objects? And after I get it on there, how do I manipulate its contents?
Another thing... I've got how you can drag the ToolStrip to the different edges of the window, but how do you do the thing where you drag it into the middle, and it floats seperately as its own window, like in Microsoft Word?
One more thing... (sorry ) How can you make the MenuStrip have the ability to be dragged to different edges of the window, like the ToolStrip can? And also, do you do the same thing for the MenuStrip as with the ToolStrip to make it float?
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
Hello everyone,
I was wondering if it is possible to create a window application with rather personalized window. What I mean is that I wish to have a different graphic rather than usual window from.
Thanx in advance for your help.
Khoramdin
|
|
|
|
|
Yes, but you shouldn't; people expect windows to look a certain way. I detest odd-looking windows. If I had to choose between two applications with similar functionality and one was non-standard I'd choose the other.
|
|
|
|
|
Hello PIEBALDconsult,
Thanx for sharing your valuable opinion. The reason I asked about the personalized window was that I have this Window application which I wish to add a floating menu to it. As the result I didn't want it to look like a normal Window Form.
This is a medial player application that I have and wish to place its control buttons in a separate window.
Maybe you can tell me if there is a better way to deal with something like this.
Thanx in advance for your input, mate.
Khoramdin
|
|
|
|
|
Hi,
This is really frustrating me. I know it should be simple but I'm darned if I can get my mind around it.
psuedo code:
datetime = aDate
string xyz = aDate.ToString("MMM dd, yyyy");
I know I can Stringbuild what I want but surely there is a simpler way. Someone please kick me in the head
Thanks.
Glen Harvy
|
|
|
|
|
You can use ToShortDate(), or you can pass a format string to ToString, although I'm not sure it looks like what you posted ( it might )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
G'day,
Thanks for your help - I played around with the .ToShortDate() but I still couldn't then format that into MMM dd, yyyy.
Ed.Poore's suggestion has done the trick though .
Cheers,
Glen Harvy
|
|
|
|
|
Could use CG's suggestion or string xyz = string.Format("{0:MMM dd, yyyy}", aDate);
|
|
|
|
|
G'day,
Great stuff - works well
I just knew that I had seen/read this somewhere and hence knew there was a simpler way.
Much appreciated.
Cheers
Glen Harvy
|
|
|
|
|
Not a problem
|
|
|
|
|
Is there an inherent limitation to the amount of available memory for a 32bit .NET application? For a simple test I'm running out of memory at around 1.4 to 1.6gb.
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
namespace MemoryTest
{
class Program
{
static void Main(string[] args)
{
int count = 0;
int size = 1024 * 1024 * 100;
byte[][] buffer = new byte[1024][];
try
{
do
{
buffer[count] = new byte[size];
Array.Clear(buffer[count], 0, buffer[count].Length);
Console.Out.WriteLine("count={0} size={1}", count.ToString(), buffer[count].Length.ToString());
MessageBox.Show("Click Ok to continue", "Got RAM?", MessageBoxButtons.OK, MessageBoxIcon.Question);
count++;
} while (true);
}
catch (Exception e)
{
Console.WriteLine("{0} Exception caught (count={1})", e, count.ToString());
}
}
}
}
Todd Smith
|
|
|
|
|
There is an inherit amount of memory available on your specific computer, that's for sure. I've run apps over the 1.4 gig mark, but I fixed them
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
haha, thats pretty much what i was thinking when reading the first post.
--
Real programmers don't comment their code. It was hard to write, it should be hard to understand.
|
|
|
|
|
Todd Smith wrote: Is there an inherent limitation to the amount of available memory for a 32bit .NET application? For a simple test I'm running out of memory at around 1.4 to 1.6gb.
That has little to do with .NET vs native. See my blog entry on the topic[^]
|
|
|
|
|
I was under the assumption that the available heap was closer to 2gb per applicaiton without the /3gb hack. What is Windows doing with that extra 400-500mb?
Todd Smith
|
|
|
|
|
Am retrieving data from my databese engine to read the data, but encountering an error at dr.Read(), con.close().
public string constring = @" ";
SqlConnection con = new SqlConnection(constring);
SqlCommand cmd = new SqlCommand("select * from emp",con);
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
con.Close();
"Invalid token '(' in class, struct, or interface member declaration", what could be the reason for this?
-- modified at 18:59 Friday 9th February, 2007
|
|
|
|
|
This should be posted in the SQL Database section.
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
sreecahitu wrote: new SqlConnection(" ");
How is that a connection string ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|