|
Forms Authentication is working fine in my app except for one thing.
If I try to go directly to a subdirectory page, a 'Resource not found' error occurs because it tries to find login.aspx in that subdirectory.
For example:
If I go to http://myapp.com/securepage.aspx, I go directly to the login page like I should.
If I go to http://myapp.com/subdir/securepage.aspx, the 'Resource not found' error occurs saying that it could not find http://myapp/subdir/login.aspx.
In web.config, I tried setting <authentication><forms loginurl="login.aspx">, then "/login.aspx", then "~/login.aspx".
What do I set to always have the application go to login.aspx in the root directory? Thanks.
|
|
|
|
|
I have two FileUpload button in my form which I put two custom validators. The issue is, when I click on first upload button, the second one also fires and says that it is required field or the similar message. Any idea what is going on?
I need to fire only those custom validator belonging to that particualr control. Here is the code:
<asp:FileUpload ID="MPNCPNFileUpload" runat="server" />
<asp:Button ID="MPNCPNFileUploadButton" runat="server" OnClick="TabFileUploadButton_Click"
Text="Upload" /></td></tr>
<tr><td><asp:CustomValidator ID="TabFileUploadErrorCustomValidator" runat="server" Display="Dynamic"
ErrorMessage="CustomValidator"
OnServerValidate="TabFileUploadedCustomValidator_ServerValidate">TextFile with MPN-CPN Details should
be uploaded</asp:CustomValidator>
<asp:FileUpload ID="DocumentFileUpload" runat="server" />
<asp:Button ID="DocumentUploadButton" runat="server" OnClick="DocumentUploadButton_Click"
Text="Upload" /></td></tr>
<tr><td><asp:CustomValidator ID="DocumentUploadedCustomValidator" runat="server" Display="Dynamic"
ErrorMessage="CustomValidator"
OnServerValidate="DocumentUploadedCustomValidator_ServerValidate">Document
must be uploaded</asp:CustomValidator>
protected void TabFileUploadedCustomValidator_ServerValidate(object source, ServerValidateEventArgs args)
{
CustomValidator cv = (CustomValidator)source;
args.IsValid = !String.IsNullOrEmpty(System.Convert.ToString(ViewState["PartsDetailFileName"]));
}
protected void DocumentUploadedCustomValidator_ServerValidate(object source, ServerValidateEventArgs args)
{
CustomValidator cv = (CustomValidator)source;
args.IsValid = !String.IsNullOrEmpty(System.Convert.ToString(ViewState["DocumentFileId"]));
}
pls help.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hi meeram395,
Validation groups might solve your problem. So if you change the first button and the custom validator like so:
<asp:button id="MPNCPNFileUploadButton" runat="server" onclick="TabFileUploadButton_Click" text="Upload" validationgroup="ValGroup1" xmlns:asp="#unknown" />
<asp:customvalidator id="TabFileUploadErrorCustomValidator" runat="server" display="Dynamic" errormessage="CustomValidator" onservervalidate="TabFileUploadedCustomValidator_ServerValidate" validationgroup="ValGroup1" xmlns:asp="#unknown">
</asp:customvalidator>
and then for the second button and custom validator:
<asp:button id="DocumentUploadButton" runat="server" onclick="DocumentUploadButton_Click" text="Upload" validationgroup="ValGroup2" xmlns:asp="#unknown" />
asp:CustomValidator ID="DocumentUploadedCustomValidator" runat="server" Display="Dynamic" ErrorMessage="CustomValidator" OnServerValidate="DocumentUploadedCustomValidator_ServerValidate" ValidationGroup="ValGroup2">
So the first button will only validate ValGroup1 and the second button will only validate ValGroup2. I hope this helps.
Ryan
|
|
|
|
|
So I need to make modification only in aspx page? There is no change in the code-behind? I mean no change in ServerValidate event?
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
No, you shouldn't need to change the code-behind.
|
|
|
|
|
Sorry for the late reply. It worked. Thank you very much.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
To solve this issue, you can set "ValidationGroup" property of each control.
Try to set MPNCPNFileUpload, MPNCPNFileUploadButton and TabFileUploadErrorCustomValidator controls "ValidationGroup" property to "2" and
DocumentFileUpload, DocumentUploadButton and DocumentUploadedCustomValidator controls "ValidationGroup" property to "3".
hope this will help you.
Regards...
Vijay Jain
|
|
|
|
|
Thanks very much. It worked.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
There is a Property called ValidationGroup.
Using this property should solve your problem.
Below is a sample:
<asp:fileupload id="MPNCPNFileUpload" runat="server" validationgroup="ValGrp1" xmlns:asp="#unknown">
<asp:button id="MPNCPNFileUploadButton" runat="server" onclick="TabFileUploadButton_Click" text="Upload" validationgroup="ValGrp1" xmlns:asp="#unknown">
<asp:customvalidator id="TabFileUploadErrorCustomValidator" runat="server" display="Dynamic" errormessage="CustomValidator" onservervalidate="TabFileUploadedCustomValidator_ServerValidate" validationgroup="ValGrp1" xmlns:asp="#unknown">
TextFile with MPN-CPN Details should be uploaded
|
|
|
|
|
Thanks to everyboyd. It got worked.. Thanks again.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
hi guys,
i try to send a mail like this:
MailMessage mailMsg = new MailMessage();<br />
mailMsg.From = new MailAddress("localhost", "Webmaster");<br />
mailMsg.To.Add(new MailAddress("localhost", "Client guy"));<br />
mailMsg.Subject = "Message Subject";<br />
mailMsg.Body = msgBody;<br />
mailMsg.IsBodyHtml = true;<br />
mailMsg.Priority = MailPriority.High;<br />
<br />
SmtpClient smtp = new SmtpClient("localhost");<br />
smtp.Send(mailMsg);
but then i get this error:
<code>The specified string is not in the form required for an e-mail address.
The smtp has already been set up from IIS. i just want to test how to send mail on my local system. how do i do this?
He who goes for revenge must first dig two graves.
|
|
|
|
|
Creamboy wrote: The specified string is not in the form required for an e-mail address.
This error means, there is something wrong with the email address you using. Make sure the email address is correct.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Yusuf.A wrote: This error means, there is something wrong with the email address you using. Make sure the email address is correct.
I know that. I'm only really asking: what do i put in there to send a mail to my local server?
He who goes for revenge must first dig two graves.
|
|
|
|
|
valid email address.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Creamboy wrote: mailMsg.From = new MailAddress("localhost", "Webmaster");
mailMsg.To.Add(new MailAddress("localhost", "Client guy"));
Change "localhost" to a valid email address.
|
|
|
|
|
It's like you know nothing about ASP.NET, the internet, or basic English comprehension.....
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
MailMessage mail = new MailMessage();
mail.To.Add("demo@gmail.com");
mail.From = new System.Net.Mail.MailAddress("from@gmail.com");
mail.Subject = "Subject";
mail.Body = "hello, this is test mail";
mail.IsBodyHtml = true;
SmtpClient client = new SmtpClient(server name);
client.Credentials = new NetworkCredential("username", "password");
client.Send(mail);
Response.Write("send mail!");
|
|
|
|
|
I'm also doing the same, but the mail goes to the Queue folder only....
what to do???
|
|
|
|
|
Hi,
I am using a Dataset, In which a Date field comes, I am assigning it to a String Variable. After than I am comparing it with Calender1.Selected Date.
If CDate(Session("DispDt")) > CType(txtDespDate.Text, Date) Then
lblMsg.Text = "Dispatch Date Must be Greater than " & MasterDispDt
txtDespDate.Text = ""
Exit Sub
End If
It is giving error as
Conversion from string "31-01-2009" to type 'Date' is not valid.
Please tell me What can be done.
Ramesh Sambari
|
|
|
|
|
verify what is coming in your date variable from database??
it will give error only in the case when date string is not valid for example..
sometimes with day instead of 02 comes only 2 when we assign it to a string and datetime conversion fucntion gives error here..... try to give valid date to string.
Government Dyal Singh College Lahore.
|
|
|
|
|
To convert a string to date, the date format should be MM/DD/YYYY OR MM/DD/YY.
Check how you are retriving the date values from database.
|
|
|
|
|
Conversion of date depends on your system's date and time setting. Probably computer assumes that 31 is month and 01 is day. Problem may be resolve by interchanging their positions like 01-31-2009, but it may appear when you deploy it to another system.
To prevent this error, write your date like 31-Jan-2009, this method will never fails cause the use of month name abbreviation. This is my regular practice and I have got no error since I use it in this format. Try and best of luck.
Be a part of solution, rather then be a part of problem
|
|
|
|
|
|
Hi,
I need to config my Report Server to be used by Forms Authentication.
Microsoft has a sample that is not compatible with VS2008. (We can convert it to 2008 using VS convertor wizard, but it's config files are different)
Do you know any sample in VS2008?
Best wishes
|
|
|
|
|
I have a page, Default.aspx, and a UserControl, HelloControl.ascx. In the page, I dynamically instantiate the control as follows:
protected void Page_Load(object sender, EventArgs e)
{
HelloControl c = new HelloControl();
Response.Write(c.Greet());
}
This works fine, and the user control returns "Hello from a control", which is written to the response. I have no @Register directive in Default.aspx, but when I try a similar dynamic control creation on a client's machine, I get an error that the "Type or Namespace does not exist".
I have even gotten feedback, on forums, from MS, that I need the @Register directive, but I obviously don't. Can anyone help me out with info on how and when the user control is compiled if no @Register directive references it?
|
|
|
|