|
Why do you want to check this in an ASP.NET application ?
|
|
|
|
|
hi all, i have strange issue and it may be dumb question, i am using below code in asp.net 1.1 to generate the cookie it is generated on some computer using locale(En-us),but cookie is not generated on some computers which have danish locale.
My question "is cookie generation depend upon the locale/Regional setting/Language"
below is the code to generate
<br />
string strCVal="2001" + "@ENG"; <br />
for(int i=0; i<Request.Cookies.Count; i++){<br />
Request.Cookies[i].Expires=DateTime.Now.AddYears(-30);<br />
}<br />
try<br />
{<br />
Response.Cookies["SCID"].Expires=DateTime.Now.AddDays(-3);<br />
}<br />
catch{}<br />
HttpCookie aCookie = new HttpCookie("SCID"); <br />
aCookie.Values[strCVal] = strCVal; <br />
aCookie.Expires = DateTime.Now.AddMinutes(5); <br />
Response.Cookies.Add(aCookie);
that code does not throw any exception as well.
Regards.
Tasleem Arif
|
|
|
|
|
hi,
can anyone help me out with API for using inter switch payment gateway ?
i am unable to find out the method to POST data to their server in asp.net..
Regards,
Ashish Sehajpal
|
|
|
|
|
Ashish Sehajpal wrote: inter switch payment gateway ?
Better place would be their customer support desk than here.
|
|
|
|
|
whenever i try to add a class file , i get the following message.
You are attempting to add a class to an asp.net application .for a class to be generally consumable in ur site . it should be placed inside the app_code folder.Would u like to place the class in the app_code folder?
Why did microsoft recomended to add the class in the app_code folder?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Check this[^]
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
app_code directory is added from .NET 2.0 onwards. Classes kept in the app_code directory are accessible to the whole website. When ASP.NET compiles, app_code and it's subdirectories will be compiled as a single assembly.
|
|
|
|
|
That means the class outside the app_code folder will not be accessible?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
if you use website project template in VS2005, you won't be able to access classes placed outside app_code. Create a new class library project to the solution and put your classes there and refer this project output to your website.
If you use web application model which is like ASP.NET 1.1 model, then you are allowed to do this, AFAIK.
|
|
|
|
|
I have a login page where I have my own label and texboxes which take input username and password, and there is a function in which there is a SP which validates username and password stored in the database.
My code in Login.aspx.cs is such that I call that function and validates username and password and redirects to next page Page2.aspx.
Now I want my site to be authorized such that if a user tries to access internal pages he couldn't be able to do that.
I have code in my WEb.config for that is
<authentication mode="Forms">
<forms cookieless="UseCookies" timeout="525600">
<authorization>
<deny users="?">
<allow users="*">
and code in login.aspx.cs is
protected void btnLogin_Click(object sender, EventArgs e)
{
validateUser = validateUser.ValidateUser(txtUserName.Text, hashedPassword);
if (Page.IsValid)
{
if (validateUser != null)
{
Response.Redirect("~/Page2.aspx");
}
else
{
lblErrorMessage.Text = "Invalid User";
}
}
}
Now when I try to run internal pages without login it automatically redirects to login page which is fine but when I put valid username and password in the login page it redirects with some "ReturnUrl" and not able to redirect to the Page2.aspx page.This is my problem.
Can anybody tell me where I am doing wrong or need to change the code somewhere?
Thanks in advance,
|
|
|
|
|
salon wrote: in the login page it redirects with some "ReturnUrl" and not able to redirect to the Page2.aspx page
Did you put your debugger in and step-through?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Thanks for instant help....
The problem is solved...
I had made changes in Web.config and it started running
|
|
|
|
|
HI,
I am using update panel in my application.but i am facing one issue.
I have one page for new enrolment of members, and i have two user controls Step1.ascx and Step2.ascx. My functionality is that at a time olny one control is visible on the page and other will be hide. for eg when user fills all fields in step1 and press next button then step2.acsx will be be visible true and user control Step1.ascx will be visible false. all this happening at postback.
both control is under update panel to avaid post back during change of visibility.
On Step1.ascx i have one javascript variable var_pageName and its value is "Step1".
I want to update this value during post back to "Step2" when Step2 user control visible is true and vise versa. but the problem i am facing is javascript value is not updating during postback. I had tried this with scriptManager.RegisterClientScriptBlock and also with scriptManager.RegisterStartupScriptBlock by palacing it on both Usercontrol level and also on page level.
Please help as this is very urgent.
Sajid A.
|
|
|
|
|
This is the FIFTH time he has asked this question!!!!!
|
|
|
|
|
using AJAX dowsn't mean that anyone can change the architecture of web application....
even in AJAX postbacks occur ! but they are not visible to user ....
and every postback will affect the server side controls and variables only.... how come you are supposed to update value of javascript variable to be changed ?
use SESSION variables instead ...
Ashish Sehajpal
|
|
|
|
|
Is there any way to display all the virtual directories , programatically?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
using System.DirectoryServices;
DirectoryEntry _iisServer = new DirectoryEntry("IIS://localhost/W3SVC/1");
foreach (DirectoryEntry entry in _iisServer.Children)
{
Console.WriteLine(entry.Name);
foreach (DirectoryEntry rootChildern in entry.Children)
{
Console.WriteLine("\t" + rootChildern.Name);
}
}
Hope this helps
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
hi Pankaj,
you can easily do that.
public DirectoryEntries GetVirtualDirectories()
{
try
{
string serverName = "localhost";
string VirDirSchemaName = "IIsWebVirtualDir";
iisServer = new DirectoryEntry("IIS://" + serverName + "/W3SVC/1");
DirectoryEntry folderRoot = iisServer.Children.Find("Root", VirDirSchemaName);
return folderRoot.Children;
}
For Load it into a Combo box
private void load_VirtualDir()
{
DirectoryEntries entries = GetVirtualDirectories();
foreach (DirectoryEntry d in entries)
{
cmboVirtual.Items.Add(d.Name);
}
}
Happy Coding
|
|
|
|
|
hi Abhijit,
What is iisserver here?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
private DirectoryEntry iisServer;
|
|
|
|
|
Is there any way to further explore the virtual directories(the files inside the virtual directory)?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Every Virtual Directory should have a physical location. if you know the physical location, try to explore that one,insted of virtual directory.
Thanks
|
|
|
|
|
actually i am trying to access the virtual directory of a remote computer , where no folder is shared.
Can i explore the virual directory now?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
AFAIK, you won't be able to list virtual directories of a remote system.
|
|
|
|
|
Yes. Try using Directory Info class
Sample
DirectoryInfo info = new DirectoryInfo("IIS://localhost/W3SVC/1/ROOT/ReportServer001Test");
FileInfo[] fileinfo = info.GetFiles();
foreach (DirectoryInfo fi in fileinfo)
{
Console.WriteLine("\t" + fi.Name);
}
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|